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

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

Re: cc-mode adds newlines


From: Luc Teirlinck
Subject: Re: cc-mode adds newlines
Date: Thu, 23 Jan 2003 23:18:21 -0600 (CST)

>From an earlier message:

       In my opinion this behaviour is unacceptable. If for some reason I
       choose to create a file with no trailing newline, it is not
       emacs's
       business to change the file silently behind my back.

   I agree.  The culprit is c-common-init in cc-mode.el which
   unconditionally sets require-final-newline to t without telling so in
   the mode documentation you get with C-h m.  I believe it should either
   use a customizable variable c-require-final-newline and tell about it
   in the mode documentation, or, maybe better, set require-final-newline
   to t if the global default value is t, and to 'maybe if the global
   default value is 'maybe or nil.  I believe this would be the best of
   both worlds:  nobody would inadvertently forget one without being
   warned and, at the same time, nothing gets done "behind the user's
   back".

I changed my mind about which of the two solutions I proposed is
better.  I now am convinced that by far the best solution is to use a
user option c-require-final-newline, keeping t as the default.  It
would not inconvenience in any way the majority of users for which
this is the correct behavior (note that I do absolutely not contest
this) and which are used to the present situation.  The user option
would show up in the customization buffer and could be mentioned in
the mode documentation string.  It would be easy for users with
sophisticated needs, like Heinrich, to find out about the default and
override it.  What I also consider to be very important is that the
c-require-final-newline solution is consistent with sh-mode's solution
to exactly the same problem: sh-require-final-newline.  This makes
Emacs as a whole more predictable and easier to understand.

Sincerely,

Luc.




reply via email to

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