From: Peter J. Weisberg Date: Fri, 23 Sep 2011 14:56:00 +0000 (-0400) Subject: * lisp/simple.el (delete-trailing-whitespace): Also delete X-Git-Tag: emacs-pretest-24.0.90~36 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d68e189a96918b113f565d5ce46257c7e9bc963c;p=emacs.git * lisp/simple.el (delete-trailing-whitespace): Also delete extra newlines at the end of the buffer. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8c52d626c02..f17ba200815 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2011-09-23 Peter J. Weisberg + * simple.el (delete-trailing-whitespace): Also delete + extra newlines at the end of the buffer. + * textmodes/picture.el: Make motion commands obey shift-select-mode. (picture-newline): Use forward-line so as to ignore fields. diff --git a/lisp/simple.el b/lisp/simple.el index 35193135396..c828584c17f 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -586,6 +586,12 @@ If the region is active, only delete whitespace within the region." (if (looking-at ".*\f") (goto-char (match-end 0)))) (delete-region (point) (match-end 0))) + (save-restriction + (goto-char end-marker) + (widen) + (if (and (eobp) + (looking-back "\n\n+" nil t)) + (replace-match "\n"))) (set-marker end-marker nil)))) ;; Return nil for the benefit of `write-file-functions'. nil)