Subject: 26.0.50; whitespace-cleanup does not remove single trailing empty line anymore

From: Mark Karpov <[email-masked]>
Date: Sat, 10 Dec 2016 17:41:52 +0300

The ‘whitespace-cleanup’ command does not remove single trailing empty
line anymore. To reproduce start emacs with -Q flag, open any file and a
single empty training line, like this:

--- start of file
foo

--- end of file

Then call ‘whitespace-cleanup’. Expected result:

--- start of file
foo
--- end of file

Actual result (nothing happens):

--- start of file
foo

--- end of file

This bug does not manifest itself if there are more than one empty line,
i.e.:

--- start of file
foo

--- end of file

(Executing ‘whitespace-cleanup’):

--- start of file
foo
--- end of file

The result is as expected.

In GNU Emacs 26.0.50.5 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.4)
 of 2016-12-10 built on arch
Repository revision: fc0fd24c105bde4c001ebebe4b8b7e1f96cd2871
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
Recent messages:
Indentation setup for shell type bash
next-line: End of buffer [5 times]
Saving file /home/mark/.bash_profile...
Wrote /home/mark/.bash_profile
Saving file /home/mark/.bash_profile...
Wrote /home/mark/.bash_profile
Quit
nil
Saving file /home/mark/.bash_profile...
Wrote /home/mark/.bash_profile

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL GNUTLS LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11
LIBSYSTEMD

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: iλ

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  aggressive-indent-mode: t
  rainbow-delimiters-mode: t
  whitespace-mode: t
  flycheck-color-mode-line-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  vimish-fold-global-mode: t
  vimish-fold-mode: t
  show-paren-mode: t
  rich-minority-mode: t
  minibuffer-electric-default-mode: t
  ivy-mode: t
  global-auto-revert-mode: t
  display-time-mode: t
  delete-selection-mode: t
  cyphejor-mode: t
  ace-popup-menu-mode: t
  smartparens-global-mode: t
  smartparens-mode: t
  flyspell-mode: t
  flyspell-lazy-mode: t
  mk-highlight-line-mode: t
  modalka-mode: t
  hl-todo-mode: t
  flycheck-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill
  transient-mark-mode: t
  auto-fill-mode: 1

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug counsel esh-util swiper sh-script smie
executable colir haskell-doc inf-haskell haskell-decl-scan imenu shell
pcomplete haskell haskell-completions haskell-load haskell-commands
highlight-uses-mode haskell-modules haskell-sandbox haskell-repl
haskell-debug haskell-interactive-mode haskell-presentation-mode
haskell-collapse haskell-navigate-imports haskell-compile
haskell-process haskell-session url-util haskell-hoogle
smartparens-haskell haskell-mode haskell-font-lock haskell-indentation
haskell-string haskell-sort-imports haskell-lexeme haskell-align-imports
haskell-compat haskell-complete-module haskell-ghc-support noutline
outline flymake etags compile dabbrev haskell-customize vc-git diff-mode
bookmark pp aggressive-indent easy-mmode rainbow-delimiters whitespace
flycheck-haskell haskell-cabal haskell-utils flycheck-color-mode-line
face-remap mk-visual smart-mode-line solarized-dark-theme solarized
color mk-texinfo mk-tex mk-shakespeare mk-prolog mk-org mk-mustache
mk-mu4e mk-markdown mk-man mk-magit mk-lisp mk-js mk-ibuffer mk-html
mk-eshell mk-erc mk-elisp mk-dired mk-clojure kill-or-bury-alive
mk-calendar mk-c mk-minor-modes common-lisp-snippets yasnippet
whole-line-or-region vimish-fold paren rich-minority minibuf-eldef ivy
ivy-overlay ffap autorevert filenotify time delsel cyphejor
ace-popup-menu smartparens-config smartparens flyspell ispell
flyspell-lazy mk-highlight-line mk-global modalka edmacro kmacro
fix-input quail ace-link hl-todo xref project mu4e mu4e-speedbar
speedbar sb-image ezimage dframe mu4e-main mu4e-context mu4e-view
cal-menu calendar cal-loaddefs thingatpt browse-url comint ansi-color
mu4e-headers mu4e-compose mu4e-draft mu4e-actions ido rfc2368 smtpmail
sendmail mu4e-mark mu4e-message html2text mu4e-proc mu4e-utils doc-view
jka-compr image-mode mu4e-lists mu4e-vars message puny dired
dired-loaddefs format-spec rfc822 mml mml-sec epa derived epg gnus-util
rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils
gmm-utils mailheader hl-line cl mu4e-meta mk-python mk-haskell mk-utils
avy-menu avy ring flycheck json map find-func rx subr-x misc server f
dash s ucs-normalize finder-inf tex-site fix-word advice slime-autoloads
info package epg-config url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache url-vars seq byte-opt
gv bytecomp byte-compile cl-extra help-mode easymenu cconv cl-loaddefs
pcase cl-lib time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript case-table epa-hook jka-cmpr-hook help
simple abbrev obarray minibuffer cl-preloaded 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 dbusbind inotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 470216 19037)
 (symbols 48 40810 0)
 (miscs 40 87 365)
 (strings 32 91124 7084)
 (string-bytes 1 2627337)
 (vectors 16 70269)
 (vector-slots 8 1777314 201698)
 (floats 8 654 304)
 (intervals 56 368 0)
 (buffers 976 16))