GNU bug report logs - #11879
24.1.50; delete-trailing-whitespace now removes empty lines at end of file

Previous Next

Package: emacs;

Reported by: Matt Arsenault <arsenm2 <at> gmail.com>

Date: Sun, 8 Jul 2012 16:24:01 UTC

Severity: normal

Found in version 24.1.50

Done: Chong Yidong <cyd <at> gnu.org>

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 11879 in the body.
You can then email your comments to 11879 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11879; Package emacs. (Sun, 08 Jul 2012 16:24:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matt Arsenault <arsenm2 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 08 Jul 2012 16:24:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Matt Arsenault <arsenm2 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.1.50;
	delete-trailing-whitespace now removes empty lines at end of file
Date: Sun, 8 Jul 2012 00:35:52 -0700
This is a regression from emacs 23.

In emacs 24, delete-trailing-whitespace remove blank lines at the end of a buffer. Previously this function would remove trailing whitespace on a line, but not change the number of lines.

Steps to reproduce: 
   1. Open a new buffer
   2. Enter a few lines of text
   3. Enter a few blank lines after the text
   4. Run M-x delete-trailing-whitespace

Expected behavior: 
   Number of lines to be unchanged. Blank lines at end of text should be there which was the behavior in emacs 23 and previous versions.

Observed behavior:
  Blank lines after the text  are removed. If the buffer is only blank lines, the first one survives the delete-trailing-whitespace.


The report may appear in public locations.


If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/Applications/Aquamacs.app/Contents/Resources/etc/DEBUG.


In GNU Emacs 24.1.50.3 (i386-apple-darwin9.8.0, NS apple-appkit-949.54)
of 2012-07-07 on braeburn.aquamacs.org - Aquamacs Distribution 3.xdev
Windowing system distributor `Apple', version 10.3.1138
Configured using:
`configure '--with-ns' '--without-x' 'CFLAGS=-arch i386 -g -O0 '
'LDFLAGS=-arch i386 -g -O0 ''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  global-linum-mode: t
  linum-mode: t
  savehist-mode: t
  smart-frame-positioning-mode: t
  aquamacs-autoface-mode: t
  recentf-mode: t
  osx-key-mode: t
  tabbar-mwheel-mode: t
  tabbar-mode: t
  show-paren-mode: t
  cua-mode: t
  tooltip-mode: t
  mouse-wheel-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
  abbrev-mode: t

Recent input:


Features:
(shadow sort mail-extr emacsbug message format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader dired-aux
cua-rect rect help-mode novice js json moz imenu dired etags
multi-isearch desktop vc-git network-stream starttls url-http tls
url-auth mail-parse rfc2231 url-gw url-cache url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
url-parse auth-source eieio gnus-util password-cache url-vars mailcap
windmove protobuf-mode cc-langs cc-mode cc-fonts cc-guess cc-menus
cc-cmds cmake-mode flymake camelCase gtk2hs haskell-ghci inf-haskell
haskell-mode derived pp compile shell pcomplete comint ring
goto-last-change cc-styles cc-align cc-engine cc-vars cc-defs edmacro
kmacro ansi-color linum auto-complete-clang load-emacs-plugins
aquamacs-mode-defaults auctex-config server preview-latex tex-site
auto-loads aquamacs-aux savehist mouse-sel one-buffer-one-frame
smart-frame-positioning drews_init color-theme-autoloads view saveplace
visual-line aquamacs-bug aquamacs-autoface-mode aquamacs-editing
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
recentf tree-widget cus-edit osxkeys emulate-mac-keyboard-mode
frame-cmds strings misc-fns thingatpt+ thingatpt frame-fns avoid
aquamacs-mac-fontsets fit-frame aquamacs-frame-setup aquamacs-tabbar
tabbar-window cl cus-start cus-load tabbar warnings
load-emacs-pre-plugins aquamacs-site-start cocoa-compatibility
matlab-load smart-dnd revive filladapt aquamacs-redo check-for-updates
aquamacs-menu osx_defaults aquamacs aquamacs-tool-bar time-date
mac-extra-functions aquamacs-tools aquamacs-macros parse-time timezone
paren delsel cua-base wid-edit advice advice-preload byte-opt bytecomp
byte-compile debug help-fns macroexp cconv image-file disp-table
easymenu easy-mmode tooltip ediff-hook vc-hooks lisp-float-type mwheel
ns-win tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-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 loaddefs button faces cus-face files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process ns multi-tty
emacs)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11879; Package emacs. (Fri, 13 Jul 2012 20:37:01 GMT) Full text and rfc822 format available.

Message #8 received at 11879 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Matt Arsenault <arsenm2 <at> gmail.com>
Cc: 11879 <at> debbugs.gnu.org
Subject: Re: bug#11879: 24.1.50;
	delete-trailing-whitespace now removes empty lines at end of file
Date: Fri, 13 Jul 2012 16:30:52 -0400
Matt Arsenault wrote:

> In emacs 24, delete-trailing-whitespace remove blank lines at the end
> of a buffer.

This appeared during the Emacs 24 feature freeze, I don't see why.
I suggest using an optional prefix argument to control this.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11879; Package emacs. (Fri, 13 Jul 2012 21:16:02 GMT) Full text and rfc822 format available.

Message #11 received at 11879 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 11879 <at> debbugs.gnu.org, Matt Arsenault <arsenm2 <at> gmail.com>
Subject: Re: bug#11879: 24.1.50; delete-trailing-whitespace now removes empty
	lines at end of file
Date: Fri, 13 Jul 2012 23:08:56 +0200
On Fri, Jul 13, 2012 at 10:30 PM, Glenn Morris <rgm <at> gnu.org> wrote:

> This appeared during the Emacs 24 feature freeze, I don't see why.
> I suggest using an optional prefix argument to control this.

Why not treat it as an annoying regression, which it is?

    Juanma




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11879; Package emacs. (Sun, 15 Jul 2012 22:38:02 GMT) Full text and rfc822 format available.

Message #14 received at 11879 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, Matt Arsenault <arsenm2 <at> gmail.com>,
	11879 <at> debbugs.gnu.org
Subject: Re: bug#11879: 24.1.50;
	delete-trailing-whitespace now removes empty lines at end of file
Date: Sun, 15 Jul 2012 18:31:46 -0400
>> This appeared during the Emacs 24 feature freeze, I don't see why.
>> I suggest using an optional prefix argument to control this.
> Why not treat it as an annoying regression, which it is?

I can't remember the exact details, but I do remember it being
introduced on purpose (tho the purpose might not have justified it).
I think it was judged that a new custom var for it or a new function was
not needed.

And, while there is a change, I haven't yet seen a clear argument that
this change is a problem.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11879; Package emacs. (Sun, 15 Jul 2012 23:13:02 GMT) Full text and rfc822 format available.

Message #17 received at 11879 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Glenn Morris <rgm <at> gnu.org>, Matt Arsenault <arsenm2 <at> gmail.com>,
	11879 <at> debbugs.gnu.org
Subject: Re: bug#11879: 24.1.50; delete-trailing-whitespace now removes empty
	lines at end of file
Date: Mon, 16 Jul 2012 01:06:00 +0200
On Mon, Jul 16, 2012 at 12:31 AM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:

> And, while there is a change, I haven't yet seen a clear argument that
> this change is a problem.

I don't think it's a matter of argument, just taste. I dislike
delete-trailing-whitespace removing lines. I have a checkout of Emacs
with a lot of changed files, and editing some of them creates spurious
differences. Hardly a catastrophe, more of a nuisance.

    Juanma




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11879; Package emacs. (Sun, 15 Jul 2012 23:16:01 GMT) Full text and rfc822 format available.

Message #20 received at 11879 <at> debbugs.gnu.org (full text, mbox):

From: Bastien <bzg <at> gnu.org>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 11879 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>,
	Matt Arsenault <arsenm2 <at> gmail.com>
Subject: Re: bug#11879: 24.1.50;
	delete-trailing-whitespace now removes empty lines at end of file
Date: Mon, 16 Jul 2012 01:10:26 +0200
Juanma Barranquero <lekktu <at> gmail.com> writes:

> On Mon, Jul 16, 2012 at 12:31 AM, Stefan Monnier
> <monnier <at> iro.umontreal.ca> wrote:
>
>> And, while there is a change, I haven't yet seen a clear argument that
>> this change is a problem.
>
> I don't think it's a matter of argument, just taste. I dislike
> delete-trailing-whitespace removing lines. I have a checkout of Emacs
> with a lot of changed files, and editing some of them creates spurious
> differences. Hardly a catastrophe, more of a nuisance.

FWIW I agree with Juanma here.

Also the name of the function suggests this.

-- 
 Bastien




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11879; Package emacs. (Mon, 16 Jul 2012 21:43:02 GMT) Full text and rfc822 format available.

Message #23 received at 11879 <at> debbugs.gnu.org (full text, mbox):

From: Sven Joachim <svenjoac <at> gmx.de>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Juanma Barranquero <lekktu <at> gmail.com>, Matt Arsenault <arsenm2 <at> gmail.com>,
	11879 <at> debbugs.gnu.org
Subject: Re: bug#11879: 24.1.50;
	delete-trailing-whitespace now removes empty lines at end of file
Date: Mon, 16 Jul 2012 23:36:23 +0200
On 2012-07-16 00:31 +0200, Stefan Monnier wrote:

>>> This appeared during the Emacs 24 feature freeze, I don't see why.
>>> I suggest using an optional prefix argument to control this.
>> Why not treat it as an annoying regression, which it is?
>
> I can't remember the exact details, but I do remember it being
> introduced on purpose (tho the purpose might not have justified it).
> I think it was judged that a new custom var for it or a new function was
> not needed.
>
> And, while there is a change, I haven't yet seen a clear argument that
> this change is a problem.

There may be cases where an empty line at the end is actually necessary.
For instance, I occasionally edit chess game files in PGN¹ format, and
removing the trailing empty line breaks the nice feature that several of
such files can be combined with cat(1) to produce a larger one.

Cheers,
       Sven


1. http://en.wikipedia.org/wiki/Portable_Game_Notation




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11879; Package emacs. (Sat, 28 Jul 2012 10:49:01 GMT) Full text and rfc822 format available.

Message #26 received at 11879 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Sven Joachim <svenjoac <at> gmx.de>
Cc: 11879 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> IRO.UMontreal.CA>,
	Matt Arsenault <arsenm2 <at> gmail.com>, Juanma Barranquero <lekktu <at> gmail.com>
Subject: Re: bug#11879: 24.1.50;
	delete-trailing-whitespace now removes empty lines at end of file
Date: Sat, 28 Jul 2012 18:41:00 +0800
Sven Joachim <svenjoac <at> gmx.de> writes:

>> And, while there is a change, I haven't yet seen a clear argument that
>> this change is a problem.
>
> There may be cases where an empty line at the end is actually necessary.
> For instance, I occasionally edit chess game files in PGN¹ format, and
> removing the trailing empty line breaks the nice feature that several of
> such files can be combined with cat(1) to produce a larger one.

I think this is a fair point, so I added `delete-trailing-lines' as an
option defaulting to t.  Major modes which need to preserve trailing
newlines can now set that to nil, (I don't think there are any such
modes in Emacs), or users can customize it.




bug closed, send any further explanations to 11879 <at> debbugs.gnu.org and Matt Arsenault <arsenm2 <at> gmail.com> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 28 Jul 2012 10:49: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. (Sat, 25 Aug 2012 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 253 days ago.

Previous Next


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