GNU bug report logs -
#21570
24.5; prog-mode unconditionally sets require-final-newline
Previous Next
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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21570 in the body.
You can then email your comments to 21570 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21570
; Package
emacs
.
(Sat, 26 Sep 2015 18:26:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Faye N." <rnddim <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 26 Sep 2015 18:26:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
In using a mode that inherits from prog-mode (perl6-mode), I found it inserting a newline at the end of my files upon saving, despite having require-final-newline set to nil. After a bit of digging, I found that prog-mode sets require-final-newline to mode-require-final-newline.
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. In my specific case, Perl 6 is not a language that balks at the lack of a final newline, so the use of mode-require-final-newline would be inappropriate for any mode implementing Perl 6 support.
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. It could either be user-configurable for prog-mode via customize, or it could be something a deriving major mode chooses to use (but then again, that would be no better than the deriving mode setting require-final-newline itself in the first place).
In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.28)
of 2015-08-25 on AMD64
Windowing system distributor `The X.Org Foundation', version 11.0.11604000
System Description: NAME=Gentoo
Configured using:
`configure --prefix=/usr --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --mandir=/usr/share/man
--infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
--localstatedir=/var/lib --disable-dependency-tracking
--disable-silent-rules --libdir=/usr/lib64 --program-suffix=-emacs-24
--infodir=/usr/share/info/emacs-24 --localstatedir=/var
--enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp
--with-gameuser=:gamestat --without-compress-install
--with-file-notification=inotify --enable-acl --with-dbus
--without-gnutls --with-gpm --without-hesiod --without-kerberos
--without-kerberos5 --without-xml2 --without-selinux --without-wide-int
--with-zlib --with-sound=alsa --with-x --without-ns --without-gconf
--without-gsettings --with-toolkit-scroll-bars --with-gif --with-jpeg
--with-png --with-rsvg --with-tiff --with-xpm --without-imagemagick
--with-xft --without-libotf --without-m17n-flt --with-x-toolkit=gtk2
GENTOO_PACKAGE=app-editors/emacs-24.5 'CFLAGS=-march=k8 -O2 -pipe'
CPPFLAGS= 'LDFLAGS=-Wl,-O1 -Wl,--as-needed''
Important settings:
value of $LC_COLLATE: C
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Perl6
Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
[not relevant]
Load-path shadows:
~/emacsmodes/cperl-mode hides /usr/share/emacs/24.5/lisp/progmodes/cperl-mode
Features:
(shadow sort mail-extr emacsbug sendmail whitespace apropos debug
mule-util epa-file epa epg perl-mode server misearch multi-isearch
cus-edit cus-start cus-load wid-edit vc-git perl6-mode derived
perl6-indent perl6-font-lock smie pcase perl6-detect tar-mode json
find-func epl rx cl-macs gv compile comint ansi-color ring autoload
lisp-mnt mm-archive message format-spec rfc822 mml mml-sec mailabbrev
gmm-utils mailheader mm-decode mm-bodies mm-encode mail-utils
network-stream starttls url-http tls mail-parse rfc2231 rfc2047 rfc2045
ietf-drums url-gw url-cache url-auth url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap url-handlers url-parse auth-source eieio byte-opt bytecomp
byte-compile cl-extra cconv eieio-core gnus-util mm-util help-fns
mail-prsvr password-cache url-vars finder-inf help-mode easymenu
cmake-mode thingatpt solarized-dark-theme solarized
solarized-theme-autoloads package epg-config site-gentoo edmacro kmacro
cl-loaddefs cl-lib imenu time-date tooltip electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind inotify
dynamic-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)
Memory information:
((conses 16 229799 51554)
(symbols 48 28232 0)
(miscs 40 1018 950)
(strings 32 47424 2827)
(string-bytes 1 1311635)
(vectors 16 27286)
(vector-slots 8 1371261 215410)
(floats 8 99 738)
(intervals 56 3990 0)
(buffers 960 29)
(heap 1024 44864 2301))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21570
; Package
emacs
.
(Sat, 26 Sep 2015 22:15:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 21570 <at> debbugs.gnu.org (full text, mbox):
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 ...)))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21570
; Package
emacs
.
(Sun, 29 Sep 2019 22:20:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 21570 <at> debbugs.gnu.org (full text, mbox):
tags 21570 + wontfix
close 21570
thanks
Dmitry Gutov <dgutov <at> yandex.ru> writes:
> 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 ...)))
Indeed, and I'm therefore closing this as wontfix.
Best regards,
Stefan Kangas
Added tag(s) wontfix.
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Sun, 29 Sep 2019 22:20:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
21570 <at> debbugs.gnu.org and "Faye N." <rnddim <at> gmail.com>
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Sun, 29 Sep 2019 22:20:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 28 Oct 2019 11:24:16 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 182 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.