unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Martin Stjernholm <mast@lysator.liu.se>
Cc: bug-cc-mode@gnu.org, acm@muc.de, Andries.Brouwer@cwi.nl,
	rms@gnu.org, emacs-devel@gnu.org
Subject: Re: cc-mode adds newlines
Date: Sun, 28 Nov 2004 15:45:00 +0100	[thread overview]
Message-ID: <5bk6s6kp77.fsf@lister.roxen.com> (raw)
In-Reply-To: <87k6sbzxro.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue, 23 Nov 2004 23:27:58 -0500")

A late response to a tiresome discussion, but as the primary
maintainer of CC Mode I think I ought to give my input to the
discussion about c-require-final-newlines:

One goal of CC Mode is to set up a buffer suitably for writing
C/C++/Java/etc code. That means modifying a number of variables - the
syntax table, comment-start and comment-end to name just a few. There
are great many dialects of these languages, so CC Mode uses the
current language standards as the authorative sources to determine its
settings. For C that standard is ISO C99, for C++ it's ISO C++ 97, for
Java it's the 2.0 language spec from Sun (since I've not yet adapted
CC Mode for the additional syntax in the upcoming J2SE 5.0), etc. I
plan to continue to update CC Mode to comply with the latest standards
as they become available.

For the languages where the standards mandate a trailing newline, CC
Mode therefore sets require-final-newline to t by default, just like
it configures the comment syntax according to the standard, recognizes
"#" for preprocessor directives in the languages that uses cpp, etc.
This to make the defaults reflect the most common editing situations.
It's of course often necessary to override them to suit a specific
situation, and just like other major modes CC Mode provides plenty of
ways to do that.

Regarding the argument that setting require-final-newline to t by
default (as opposed to setting the multitude of other variables to
various defaults) makes things happen "behind the back" of the user, I
believe it's only a subjective perception: It's a sign that something
happened that a specific user didn't expect; in reality there are lots
of stuff that happens "behind the back", but as long as they agree to
the user's expectations they aren't percieved that way. Therefore it
can just as well be due to lack of knowledge from the user as it is
counterintuitive behavior in the program. Other arguments are
necessary to discern where the fault is.

Anyway, I've now explained the policy behind the default used by CC
Mode, and so far I haven't seen any good arguments to depart from it
in this specific case.

As for c-require-final-newlines, I think in hindsight that it's an
ugly kludge and that it was a mistake. I agree with Stefan Monnier:
The generic way to override a variable in a specific mode is to set it
in a mode hook (or by using file local variables), and that ought to
work in this case too. If the problem is that mode hooks are too
difficult to use by many users then a simpler generic way to do mode
specific variable overrides should be added. A growing plethora of
special case variables like c-require-final-newlines does not make
things easy to understand.

I don't intend to remove c-require-final-newlines again, however.
Instead I'll be happy to deprecate it when a better tool is available.

  reply	other threads:[~2004-11-28 14:45 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3671.1100818498.8225.bug-gnu-emacs@gnu.org>
2004-11-18 23:31 ` cc-mode adds newlines 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
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 [this message]
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-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

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5bk6s6kp77.fsf@lister.roxen.com \
    --to=mast@lysator.liu.se \
    --cc=Andries.Brouwer@cwi.nl \
    --cc=acm@muc.de \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rms@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 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).