unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andries Brouwer <Andries.Brouwer@cwi.nl>
Cc: Andries Brouwer <Andries.Brouwer@cwi.nl>,
	emacs-devel@gnu.org, Jari Aalto <jari.aalto@cante.net>
Subject: Re: cc-mode adds newlines
Date: Sun, 21 Nov 2004 03:08:52 +0100	[thread overview]
Message-ID: <20041121020850.GA20436@apps.cwi.nl> (raw)
In-Reply-To: <Pine.LNX.3.96.1041120141702.315A-100000@acm.acm>

On Sat, Nov 20, 2004 at 03:14:24PM +0000, Alan Mackenzie wrote:

> >It is not the goal of an editor to force the user to write syntactically
> >correct programs.
> 
> Well, that is debateable.  I'd tend to agree with you, whilst pointing
> out that in this case, there was no "force" used [see below].
> 
> An equally valid argument is that of the programmer who hacks through the
> night and sets off a build (which takes several hours to complete), goes
> home for some sleep, then comes back into the office the following
> afternoon.  He then finds that the build failed for lack of a final
> newline in one of the files.  Then he expostulates "FAQ!  Why couldn't
> that stupid editor have put that stupid newline in for me?".

That is a phantasy argument.
Old compilers just accept the C source without final newline
without any complaint. Some newer pedantic ones print a warning.

> >It is excellent if the editor helps the user, warns for things that
> >often are mistakes, etc. But the user is the final authority.
> 
> You'll note that, for example, CC Mode warns you about unterminated
> strings and unterminated comments.  [Don't laugh - before the days of
> syntax highlighting, unterminated comments were the utter devil to find -
> often the resulting source was syntactically valid, but the "else" bit of
> an "if" got commented out, for example.]

I have been using C for thirty years or so.

> >In this case of newlines emacs considers itself as final authority. That
> >is a serious bug. It must ask by default.
> 
> No.  It is _your_ copy of Emacs, and it is _your_ choice how you
> configure it.  You can actually set Emacs up to ask about final-newlines
> first (see the Emacs manual, page "Saving", then use that information to
> set c-require-final-newline), but you've probably found that out already.

That is a phantasy argument. If emacs dumps core when I do something,
and there is a variable do-not-dump-core you cannot point out the
existence of the variable to dismiss the bug.

The alist c-require-final-newline was an extremely poor design decision.
The single variable require-final-newline is excellent, especially
if the default is ask.

It is very poor design to add switches and variables just because
it is a logical possibility that someone might want it.

It is not true that emacs is getting better and better as the number
of variables that can be customised increases.

> I think your complaint here is that you didn't know about the setting,
> and had no reason to suspect it might exist, and therefore no reason to
> spend weeks meticulously searching through the manual for anything random
> which might mess up your files.  That's a fair complaint.

Not precisely. The (stupid, buggy) variable that was added later
does not yet exist in my version of emacs. For me the fastest
would have been to save the file, rename it, delete the final newline,
rename it back. Silly kludges showing the brokenness of emacs.

> It's also fair for me to ask, did you suffer any actual damage
> from this terminating newline?  Something like the source file
> being an input to some scriptfile, rather than just being compiled,
> and that script fouling up?

Yes. I needed a file without trailing newline.

> >It is not true that all dialects of C require a final newline.
> 
> Yes, but _some_ of them do, and more importantly the C standard does.

But again - that is almost irrelevant.
Emacs must enable me to do what I want to or need to do.
It is nice if it warns me when it thinks something might be wrong.

If emacs thinks that the file being edited perhaps is a C program
(for example because the name ends in .c), and moreover that I
perhaps want to create a file that satisfies the C99 standard,
then it should warn. It should not do anything at all on its own accord
behind my back.

Andries

  reply	other threads:[~2004-11-21  2:08 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 [this message]
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
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=20041121020850.GA20436@apps.cwi.nl \
    --to=andries.brouwer@cwi.nl \
    --cc=emacs-devel@gnu.org \
    --cc=jari.aalto@cante.net \
    /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).