[Top][All Lists]

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

Possibly unwanted trailing spaces in comments created by M-;

From: Alan Mackenzie
Subject: Possibly unwanted trailing spaces in comments created by M-;
Date: Wed, 20 Jan 2016 21:16:18 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

Hello, Emacs.

The following issue arose from bug #22369:

Start the emacs-25 branch's emacs with "emacs -Q".
Load the following file into a C Mode buffer:

        void main()
         int i;

         int b;
         printf("format string");

, then do "M-: (setq comment-style 'extra-line)".  Now mark the function
with C-M-h.  Do M-; to comment the region.  The result is this:

 1      /*
 2       * void main()
 3       * {
 4       *   int i;
 5       *
 6       *   int b;
 7       *   printf("format string");
 8       * }
 9       */

There is a trailing space on line 1 and 5 (but not on line 9).  My
feeling is that we shouldn't be inserting this trailing space on new
lines, or on what used to be blank lines, even when `comment-start' ends
in one or more spaces.  For example, some version control setups reject
patches with trailing spaces.

Should I amend newcomment.el so that trailing spaces are not inserted?
(Clearly, one could introduce a new user option as to whether these
spaces are wanted, but this seems over the top.)

Geyslan Bem, who submitted bug #22369, also requested a new comment style
similar to 'extra-line, where an extra comment line would be inserted
only above the existing text (or it might have been below).  How do
people feel about 'extra-above and 'extra-below being implemented (in the
master branch, of course)?

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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