bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#193:


From: Alan Mackenzie
Subject: bug#193:
Date: Tue, 6 Jul 2010 19:29:34 +0000
User-agent: Mutt/1.5.9i

On Sun, Jun 27, 2010 at 02:47:52PM +0200, Deniz Dogan wrote:
> Did anyone ever agree on what needs to be done to fix the problem?
 
A quick reminder of what the problem is.  In C mode (NOT C++ mode):
(i) Type M-q in a pair of short line comments like this

// Two short
// lines.

The command ought to join them into a single line comment.  Instead, it
does nothing;

(ii) Type M-q in a line comment which is longer than fill-column:

// A long line comment, which is far far far longer than a moderately or very 
small fill-column.

This miss-fills by splitting the line, but putting no comment marker on
the new second line:.

// A long line comment, which is far far far longer than a moderately or
very small fill-column.

These bugs are regressions between Emacs 21.4 and 22.1.

#########################################################################

Both these bugs seem to be caused by a strange clause in
`fill-paragraph', where what should be the fill-prefix ("// ") is made
a component of `paragraph-start'.  Thus (ii) every line in the comment
sequence is automatically made into its own paragraph; and (i) when
splitting lines, fill-paragraph doesn't insert the fill-prefix when this
is also a paragraph starter.

Here is the strange code:

     ;; Try to prevent code sections and comment sections from being
     ;; filled together.
     (when (and fill-paragraph-handle-comment comment-start-skip)
       (setq paragraph-start
             (concat paragraph-start "\\|[ \t]*\\(?:"
                     comment-start-skip "\\)")))

In C Mode, `comment-start-skip' is "\\(//+\\|/\\*+\\)\\s *".

The two bugs vanish when the above code is removed.

Stefan, can you remember why you put this code in (revision 86672 of
2008-04-11)?  Is there perhaps a way of achieving the same effect
without making the fill-prefix match `paragraph-start'?

> -- 
> Deniz Dogan

-- 
Alan Mackenzie (Nuremberg, Germany).





reply via email to

[Prev in Thread] Current Thread [Next in Thread]