[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cperl-fill-paragraph breaks comments

From: offby1
Subject: cperl-fill-paragraph breaks comments
Date: Sat, 31 Jan 2004 17:27:47 -0800

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the address@hidden mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

* put the content between the === lines into bug.pl:
  # yadda yadda
  # yadda yadda
* Start emacs with `runemacs -q'
* C-x C-f bug.pl
* M-x cperl-mode RET
* M-<
* C-n
* M-q

Note that the buffer now looks like
  # yadda yadda
   yadda yadda

This is a bug: the `#' character is missing from the third line.

The following patch (I can't remember where I got it from) fixes
this, and perhaps other problems (I've been using it for months with
no problems)

    diff -wu cperl-mode.el cperl-mode.el.mine
    --- cperl-mode.el    2004-01-30 14:56:25.490664400 -0800
    +++ cperl-mode.el.mine    2003-11-03 15:16:05.721058700 -0800
    @@ -1022,7 +1022,7 @@
       (cperl-define-key "\e\C-q" 'cperl-indent-exp) ; Usually not bound
       (cperl-define-key [?\C-\M-\|] 'cperl-lineup
                        [(control meta |)])
    -  ;;(cperl-define-key "\M-q" 'cperl-fill-paragraph)
    +  (set (make-local-variable 'fill-paragraph-function) 'cperl-fill-paragraph)
       ;;(cperl-define-key "\e;" 'cperl-indent-for-comment)
       (cperl-define-key "\177" 'cperl-electric-backspace)
       (cperl-define-key "\t" 'cperl-indent-command)
    @@ -1064,12 +1064,6 @@
          'indent-sexp 'cperl-indent-exp
          cperl-mode-map global-map)
    -     'fill-paragraph 'cperl-fill-paragraph
    -     cperl-mode-map global-map)
    -    (substitute-key-definition
    -     'indent-region 'cperl-indent-region
    -     cperl-mode-map global-map)
    -    (substitute-key-definition
          'indent-for-comment 'cperl-indent-for-comment
          cperl-mode-map global-map)))

    @@ -1086,7 +1080,7 @@
              ["End of function" end-of-defun t]
              ["Mark function" mark-defun t]
              ["Indent _expression_" cperl-indent-exp t]
    -      ["Fill paragraph/comment" cperl-fill-paragraph t]
    +      ["Fill paragraph/comment" fill-paragraph t]
              ["Line up a construction" cperl-lineup (cperl-use-region-p)]
              ["Invert if/unless/while etc" cperl-invert-if-unless t]
    @@ -4346,9 +4340,12 @@
           (let ((c (save-excursion (beginning-of-line)
                                   (cperl-to-comment-or-eol) (point)))
                (s (memq (following-char) '(?\ ?\t))) marker)
    -    (if (>= c (point)) nil
    +       (if (>= c (point))
    +           ;; Don't break line inside code: only inside comment.
    +           nil
              (setq marker (point-marker))
    -      (cperl-fill-paragraph)
    +      (fill-paragraph nil)
              (goto-char marker)
              ;; Is not enough, sometimes marker is a start of line
              (if (bolp) (progn (re-search-forward "#+[ \t]*")

In GNU Emacs (i386-mingw-nt5.0.2195)
of 2004-01-29 on SLOP
configured using `configure --with-gcc (3.2)'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

Major mode: CPerl

Minor modes in effect:
  display-time-mode: t
  auto-compression-mode: t
  iswitchb-mode: t
  mouse-wheel-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  line-number-mode: t

Recent input:
C-y C-y C-y C-y C-y C-y C-y C-y C-y C-y C-y C-y C-y
C-y C-y M-q C-p M-q C-a C-M-o C-x C-o C-p M-q C-a C-p
C-M-o { M-> } C-M-p C-M-q C-n M-q C-x u M-q
C-x u C-n C-k C-x C-o C-p M-q C-p C-e
M-q C-p C-e M-b M-b M-b M-b M-b M-b
# SPC M-q C-x u M-f M-f C-k C-p C-k M-> M-x r e p l
o r c p e r l - m o d e
C-g C-h c M-q M-x r e M-p

Recent messages:
Mark set
Indenting... (100%)
Undo! [3 times]
Mark set
Loading emacsbug...done
M-q runs the command cperl-fill-paragraph
Loading dabbrev...done
dabbrev-expand: No dynamic expansion for `cperl-fill' found
dabbrev-expand: No dynamic expansion for `cperl-fill-pa' found

The one thing that unites all human beings, regardless of age,
gender, religion, economic status or ethnic background, is that
deep down inside, we all believe that we are above average
         -- Dave Barry

reply via email to

[Prev in Thread] Current Thread [Next in Thread]
  • cperl-fill-paragraph breaks comments, offby1 <=