GNU bug report logs - #21570
24.5; prog-mode unconditionally sets require-final-newline

Previous Next

Package: emacs;

Reported by: "Faye N." <rnddim <at> gmail.com>

Date: Sat, 26 Sep 2015 18:26:03 UTC

Severity: wishlist

Tags: wontfix

Found in version 24.5

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: "Faye N." <rnddim <at> gmail.com>, 21570 <at> debbugs.gnu.org
Subject: bug#21570: 24.5; prog-mode unconditionally sets require-final-newline
Date: Sun, 27 Sep 2015 01:14:05 +0300
On 09/26/2015 12:50 PM, Faye N. wrote:

> While normally I don't have an issue with this sort of thing (I leave mode-require-final-newline on specifically for programs that have yet to handle the lack of final newlines in their input files), the fact that this is in prog-mode seems like a bug to me. prog-mode as I understand it is mainly for other modes to derive from as a starting point, so forcing a final newline in a generic major mode such as this is wrong to me.

prog-mode is the place where the mode-require-final-newline setting 
takes effect, in a centralized fashion.

Regardless of the programming language in question, certain tools that 
one might want to employ for software development interact badly with 
source files that don't end on a newline. Hence it's a good idea to add 
them in source files.

But when it's not the case, a major mode, or the user, can override this 
(in the mode definition, or in a hook).

> I'd suggest either not having prog-mode set this in the first place (leaving it to modes that actually need it to decide), or if prog-mode has to set it, that its doing so be configurable.

Since it's the first such request, I think the degree of customizability 
provided by our hooks facility is enough:

(add-hook 'prog-mode-hook (lambda () (setq require-final-newline ...)))





This bug report was last modified 5 years and 236 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.