all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Deniz Dogan <deniz.a.m.dogan@gmail.com>
Cc: 193@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>,
	emacs-devel@gnu.org
Subject: Re: bug#193:
Date: Tue, 6 Jul 2010 19:29:34 +0000	[thread overview]
Message-ID: <20100706192934.GA3741@muc.de> (raw)
In-Reply-To: <AANLkTill7PHyqYrJ8BWBN5nP_XLksHl9Dm0rPQvnE8b1@mail.gmail.com>

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).



  parent reply	other threads:[~2010-07-06 19:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-06 21:49 Fill for // (C++) style comments in C (C99) Richard Hansen
2010-06-27 12:47 ` bug#193: Deniz Dogan
2010-07-05 20:06   ` bug#193: Alan Mackenzie
2011-03-05 20:43     ` bug#193: Glenn Morris
2010-07-06 19:29   ` bug#193: Alan Mackenzie
2010-07-06 19:29   ` Alan Mackenzie [this message]
2010-07-09 18:51   ` bug#193: Fix for bug#193 Alan Mackenzie
2010-07-10  1:41     ` Christoph
2010-07-11 18:55       ` Alan Mackenzie
2010-07-14  1:08         ` Christoph
2010-08-06 18:59           ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100706192934.GA3741@muc.de \
    --to=acm@muc.de \
    --cc=193@debbugs.gnu.org \
    --cc=deniz.a.m.dogan@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.