unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Possibly unwanted trailing spaces in comments created by M-;
@ 2016-01-20 21:16 Alan Mackenzie
  0 siblings, 0 replies; only message in thread
From: Alan Mackenzie @ 2016-01-20 21:16 UTC (permalink / raw)
  To: emacs-devel; +Cc: Geyslan G. Bem

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	 */
10  

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-01-20 21:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-20 21:16 Possibly unwanted trailing spaces in comments created by M-; Alan Mackenzie

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).