unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11879: 24.1.50; delete-trailing-whitespace now removes empty lines at end of file
@ 2012-07-08  7:35 Matt Arsenault
  2012-07-13 20:30 ` Glenn Morris
  0 siblings, 1 reply; 8+ messages in thread
From: Matt Arsenault @ 2012-07-08  7:35 UTC (permalink / raw)
  To: 11879

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)





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#11879: 24.1.50; delete-trailing-whitespace now removes empty lines at end of file
  2012-07-08  7:35 bug#11879: 24.1.50; delete-trailing-whitespace now removes empty lines at end of file Matt Arsenault
@ 2012-07-13 20:30 ` Glenn Morris
  2012-07-13 21:08   ` Juanma Barranquero
  0 siblings, 1 reply; 8+ messages in thread
From: Glenn Morris @ 2012-07-13 20:30 UTC (permalink / raw)
  To: Matt Arsenault; +Cc: 11879

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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#11879: 24.1.50; delete-trailing-whitespace now removes empty lines at end of file
  2012-07-13 20:30 ` Glenn Morris
@ 2012-07-13 21:08   ` Juanma Barranquero
  2012-07-15 22:31     ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Juanma Barranquero @ 2012-07-13 21:08 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 11879, Matt Arsenault

On Fri, Jul 13, 2012 at 10:30 PM, Glenn Morris <rgm@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#11879: 24.1.50; delete-trailing-whitespace now removes empty lines at end of file
  2012-07-13 21:08   ` Juanma Barranquero
@ 2012-07-15 22:31     ` Stefan Monnier
  2012-07-15 23:06       ` Juanma Barranquero
  2012-07-16 21:36       ` Sven Joachim
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2012-07-15 22:31 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: Matt Arsenault, 11879

>> 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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#11879: 24.1.50; delete-trailing-whitespace now removes empty lines at end of file
  2012-07-15 22:31     ` Stefan Monnier
@ 2012-07-15 23:06       ` Juanma Barranquero
  2012-07-15 23:10         ` Bastien
  2012-07-16 21:36       ` Sven Joachim
  1 sibling, 1 reply; 8+ messages in thread
From: Juanma Barranquero @ 2012-07-15 23:06 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Matt Arsenault, 11879

On Mon, Jul 16, 2012 at 12:31 AM, Stefan Monnier
<monnier@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#11879: 24.1.50; delete-trailing-whitespace now removes empty lines at end of file
  2012-07-15 23:06       ` Juanma Barranquero
@ 2012-07-15 23:10         ` Bastien
  0 siblings, 0 replies; 8+ messages in thread
From: Bastien @ 2012-07-15 23:10 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 11879, Matt Arsenault

Juanma Barranquero <lekktu@gmail.com> writes:

> On Mon, Jul 16, 2012 at 12:31 AM, Stefan Monnier
> <monnier@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#11879: 24.1.50; delete-trailing-whitespace now removes empty lines at end of file
  2012-07-15 22:31     ` Stefan Monnier
  2012-07-15 23:06       ` Juanma Barranquero
@ 2012-07-16 21:36       ` Sven Joachim
  2012-07-28 10:41         ` Chong Yidong
  1 sibling, 1 reply; 8+ messages in thread
From: Sven Joachim @ 2012-07-16 21:36 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Juanma Barranquero, Matt Arsenault, 11879

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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#11879: 24.1.50; delete-trailing-whitespace now removes empty lines at end of file
  2012-07-16 21:36       ` Sven Joachim
@ 2012-07-28 10:41         ` Chong Yidong
  0 siblings, 0 replies; 8+ messages in thread
From: Chong Yidong @ 2012-07-28 10:41 UTC (permalink / raw)
  To: Sven Joachim; +Cc: 11879, Matt Arsenault, Juanma Barranquero

Sven Joachim <svenjoac@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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-07-28 10:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-08  7:35 bug#11879: 24.1.50; delete-trailing-whitespace now removes empty lines at end of file Matt Arsenault
2012-07-13 20:30 ` Glenn Morris
2012-07-13 21:08   ` Juanma Barranquero
2012-07-15 22:31     ` Stefan Monnier
2012-07-15 23:06       ` Juanma Barranquero
2012-07-15 23:10         ` Bastien
2012-07-16 21:36       ` Sven Joachim
2012-07-28 10:41         ` Chong Yidong

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).