emacs-devel
[Top][All Lists]
Advanced

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

Re: cc-mode adds newlines


From: Andries Brouwer
Subject: Re: cc-mode adds newlines
Date: Sun, 21 Nov 2004 13:26:29 +0100
User-agent: Mutt/1.4i

On Sun, Nov 21, 2004 at 11:41:34AM +0000, Alan Mackenzie wrote:

> I've had a search through the archives.  I found your bug report in
> gnu.emacs.bug recently, and a previous bug report (strangely enough, with
> exactly the same subject, "cc-mode adds newlines" ;-), from
> Heinrich Rommerskirchen <address@hidden> on Thu, 23
> Jan 2003 13:17:12.  Maybe you've read through that thread already.  That
> also lead to discussion on the CC Mode mailing list (archived on
> <http://cc-mode.sourceforge.net> somewhere), which led to the
> introduction of `c-require-final-newline'.
> 
> Heinrich Rommerskirchen's complaint was that c-mode silently set
> require-final-newline to t without him being able to do anything about
> it.  c-require-final-newline was the answer to that, giving people a way
> to "do something about it".  It was given the default value ((c-mode . t)
> (c++-mode .t) (objc-mode .t)) so as not to change the behaviour for users
> used to the old way.

Yes, indeed. Heinrich Rommerskirchen wrote:

    cc-mode tries to be smart and adds newlines to a file without
    informing the user and without any easily found option to suppress
    it.

You see - nobody wants c-require-final-newline.
It is a misfeature. Heinrich Rommerskirchen hated getting a final
newline added by emacs behind his back. I hate it.

One does not become happier if there is a complicated way to make emacs
not do it. Emacs should not do it in the first place.

This misfeature was only added because cc-mode had another misfeature:
it blindly overrides global variable settings.

That makes life much more difficult for users. If they do something
globally, they also have to make the same change locally for all
major modes they will encounter, in order to have a uniform interface.

require-final-newline is a beautiful variable. Set it to ask by default
and some people will make it always true, some will make it always false.
Many will leave it to ask.

c-require-final-newline is an ugly bug. Who will change its value?
Only people who have been bitten by the fact that emacs changed their files,
spent time in debugging, spent time in searching the docs, spent time in
searching the net. And when c-require-final-newline is just equal to
require-final-newline and the latter has default ask, then nobody is
ever bitten.

If you insist that c-require-final-newline must exist, also that
must have default ask. But there is really no reason why
anybody would set it differently from require-final-newline.
If one only edits text files, set require-final-newline to true.
If one sometimes edits arbitrary files, set it to ask.
Also an arbitrary file can have a name ending in .c.
If one always knows what one is doing and never makes mistakes,
set it to false.

Andries




reply via email to

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