all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
Cc: bug-cc-mode@gnu.org, emacs-devel@gnu.org
Subject: Re: cc-mode adds newlines
Date: Sun, 21 Nov 2004 13:52:49 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.3.96.1041121131657.297B-100000@acm.acm> (raw)
In-Reply-To: <20041121122629.GE20436@apps.cwi.nl>

Hi, Andries!

On Sun, 21 Nov 2004, Andries Brouwer wrote:

>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 <heinrich.rommerskirchen@siemens.com> 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.

Untrue - Alfred M. Szmidt, for one, wants it.  If nobody wanted it, it
wouldn't have been implemented.

>It is a misfeature. Heinrich Rommerskirchen hated getting a final
>newline added by emacs behind his back. I hate it.

Yes, I think that's clear by now.  ;-)  The difference is, Heinrich had
no easy way of disabling this "feature".  Thanks to his bug report, you
do (assuming you've got CC Mode >= 5.30.  If you haven't, get 5.30.9 from
<http://cc-mode.sourceforge.net.release.php>).

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

It is a simple way.  The only difficult thing about it is discovering its
existence.

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

Yes indeed, but not blindly.  For example, it changes the
paragraph-start and paragraph-separate variables to recognise
comment-prefices (the "* " you have at the beginning of each comment
line), so that when you do M-q in a block comment, it doesn't just jumble
the entire comment into a compact mess.

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

Users often want these things set differently in different modes.

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

And some will want it t in C Mode and nil in Text Mode, and really don't
want to be bothered answering the question "Add one? (y or n)" twenty
times a day.

>c-require-final-newline is an ugly bug. Who will change its value?

_You_ will.  By putting the correct (for you) setting of it in your
.emacs file.

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

OK, you've been bitten.  Sorry.  It's happened already and it can't now
be undone.  The criticism in the previous paragraph is fair.  But read
the threads from January 2003, the ones that lead to the creation of that
variable, and see if you can come up with a better solution, given the
conflicting demands of (i) full customizability; (ii) the need to maintain
compatibility with existing behaviour; (iii) the need to keep users
informed about what's being done; (iv) the need not to irritate users
with excessive "are you sure?" type questions; .....

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

Yes there is - To have appropriate (but different) values in Text Mode, C
Mode and AWK Mode, to name just three.  And if we changed the default
value to ask, complaints from other people would start rolling in.
That's guaranteed.  ;-(

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

Other people see things differently.  Emacs tries to cater for all
different tastes and preferences, and deciding on the Right defaults is
difficult.  Configure your .emacs file so that you won't get caught out
again.  Other than that, I don't think anybody can offer you much more
help.

>Andries

-- 
Alan Mackenzie (Munich, Germany)

  parent reply	other threads:[~2004-11-21 13:52 UTC|newest]

Thread overview: 112+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3671.1100818498.8225.bug-gnu-emacs@gnu.org>
2004-11-18 23:23 ` cc-mode adds newlines Kevin Rodgers
2004-11-19  0:46   ` Andreas Schwab
2004-11-18 23:31 ` Jari Aalto
2004-11-19 20:27   ` Alan Mackenzie
2004-11-19 23:13     ` Andries Brouwer
2004-11-20  0:13       ` Miles Bader
2004-11-20 15:14       ` Alan Mackenzie
2004-11-21  2:08         ` Andries Brouwer
2004-11-21 10:00           ` Miles Bader
2004-11-21 11:38             ` Andries Brouwer
2004-11-21 12:08               ` Alfred M. Szmidt
2004-11-21 12:45                 ` Andries Brouwer
2004-11-21 12:58                   ` Alfred M. Szmidt
2004-11-21 13:03                     ` Andries Brouwer
2004-11-21 13:09                       ` Alfred M. Szmidt
2004-11-25 15:59                         ` cc-mode adds newlines version=2.64 Jari Aalto
2004-11-22  0:03                     ` cc-mode adds newlines Stefan Monnier
2004-11-21 12:53               ` Miles Bader
2004-11-21 13:00                 ` Andries Brouwer
2004-11-21 13:14                   ` David Kastrup
2004-11-21 13:35                     ` Andries Brouwer
2004-11-21 13:41                       ` David Kastrup
2004-11-21 13:54                         ` Andries Brouwer
2004-11-21 15:54                           ` Thien-Thi Nguyen
2004-11-21 11:06           ` David Kastrup
2004-11-21 11:45             ` Andries Brouwer
2004-11-21 12:08               ` David Kastrup
2004-11-21 11:41           ` Alan Mackenzie
2004-11-21 12:26             ` Andries Brouwer
2004-11-21 12:34               ` David Kastrup
2004-11-21 12:49                 ` Andries Brouwer
2004-11-21 13:08                   ` David Kastrup
2004-11-21 13:28                     ` Andries Brouwer
2004-11-21 13:37                       ` David Kastrup
2004-11-21 13:43                         ` Andries Brouwer
2004-11-21 13:51                           ` David Kastrup
2004-11-21 14:03                             ` Andries Brouwer
2004-11-21 15:01                               ` David Kastrup
2004-11-21 15:08                                 ` Andries Brouwer
2004-11-22 19:21                                   ` Kevin Rodgers
2004-11-21 15:18                               ` Andreas Schwab
2004-11-21 15:36                                 ` Andries Brouwer
     [not found]                       ` <01c4d003$Blat.v2.2.2$3d9a05c0@zahav.net.il>
2004-11-21 21:28                         ` Andries Brouwer
2004-11-22  4:35                           ` Eli Zaretskii
2004-11-22  9:04                           ` David Kastrup
2004-11-21 13:52               ` Alan Mackenzie [this message]
2004-11-21 14:29                 ` Andries Brouwer
2004-11-21 15:07                   ` David Kastrup
2004-11-21 15:20                     ` Andries Brouwer
2004-11-21 19:03                   ` Alfred M. Szmidt
2004-11-21 21:19                     ` Andries Brouwer
2004-11-21 21:46                       ` Alfred M. Szmidt
2004-11-21 22:19                         ` Andries Brouwer
2004-11-22 11:54                       ` Benjamin Riefenstahl
2004-11-22 15:54                         ` Andries Brouwer
2004-11-22 16:56                           ` Andreas Schwab
2004-11-21 15:50                 ` Kai Grossjohann
2004-11-22 19:20                   ` Kevin Rodgers
2004-11-24 10:12                     ` Kai Grossjohann
     [not found]               ` <01c4d002$Blat.v2.2.2$50b57dc0@zahav.net.il>
2004-11-21 21:21                 ` Andries Brouwer
2004-11-22  4:31                   ` Eli Zaretskii
2004-11-22  0:12             ` Stefan Monnier
2004-11-22 14:07             ` Richard Stallman
2004-11-22 15:52               ` Stefan Monnier
2004-11-22 19:16                 ` Kevin Rodgers
2004-11-22 20:06                   ` Stefan Monnier
2004-11-24  2:27                 ` Richard Stallman
2004-11-24  4:27                   ` Stefan Monnier
2004-11-28 14:45                     ` Martin Stjernholm
2004-11-29  6:11                       ` Richard Stallman
2004-11-30 10:51                         ` Martin Stjernholm
2004-12-01  2:56                           ` Richard Stallman
2004-11-21 14:47           ` Andreas Schwab
2004-11-21 15:03             ` Andries Brouwer
2004-11-21 15:39         ` Richard Stallman
2004-11-21 21:47           ` Alan Mackenzie
2004-11-23 16:30             ` Richard Stallman
2004-11-25  2:21             ` Richard Stallman
2004-11-25 20:35               ` Alan Mackenzie
2004-11-18 23:31 ` Jari Aalto
     [not found] ` <mailman.3684.1100821293.8225.bug-gnu-emacs@gnu.org>
2004-11-19  0:14   ` Stefan Monnier
2004-11-19 20:04     ` Richard Stallman
     [not found]     ` <mailman.56.1100895632.27204.bug-gnu-emacs@gnu.org>
2004-11-19 22:00       ` Hallvard B Furuseth
2004-11-21 15:38         ` Richard Stallman
     [not found]         ` <mailman.416.1101052189.27204.bug-gnu-emacs@gnu.org>
2004-11-22  5:55           ` Paul D. Smith
     [not found]           ` <mailman.619.1101127694.27204.bug-gnu-emacs@gnu.org>
2004-11-22 18:55             ` Stefan Monnier
     [not found]             ` <mailman.723.1101150150.27204.bug-gnu-emacs@gnu.org>
2004-11-22 19:37               ` Hallvard B Furuseth
2004-11-22 22:49                 ` Andreas Schwab
     [not found]                 ` <mailman.778.1101164414.27204.bug-gnu-emacs@gnu.org>
2004-11-28 19:39                   ` Hallvard B Furuseth
2004-11-28 16:56 Andries.Brouwer
     [not found] ` <Andries.Brouwer@cwi.nl>
2004-11-28 17:17   ` Martin Stjernholm
2004-11-28 20:20     ` Andries Brouwer
2004-11-29  0:14       ` Kim F. Storm
2004-11-30  7:01       ` Richard Stallman
2004-12-31 15:26         ` Richard Stallman
2004-12-31 16:56           ` Andries Brouwer
2005-01-02 16:05             ` Richard Stallman
2005-01-02 18:02               ` Andries Brouwer
2004-11-30  7:01 ` Richard Stallman
2004-11-30  8:11   ` David Kastrup
2004-12-01  2:56     ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2004-11-18 22:45 Andries.Brouwer
2003-01-24  5:18 Luc Teirlinck
2003-01-24  2:41 Luc Teirlinck
2003-01-24  1:36 Luc Teirlinck
2003-01-25 19:22 ` Richard Stallman
     [not found] ` <mailman.985.1043522856.21513.bug-gnu-emacs@gnu.org>
2003-01-26 20:24   ` Benjamin Riefenstahl
     [not found] <mailman.884.1043357104.21513.bug-gnu-emacs@gnu.org>
2003-01-23 23:35 ` Benjamin Riefenstahl
2003-01-23 22:41 Luc Teirlinck
2003-01-23 21:52 Luc Teirlinck
2003-01-23 21:25 Luc Teirlinck
2003-01-23 13:17 Rommerskirchen Heinrich

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=Pine.LNX.3.96.1041121131657.297B-100000@acm.acm \
    --to=acm@muc.de \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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.