emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105888: * lisp/simple.el (delete-tra


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105888: * lisp/simple.el (delete-trailing-whitespace): Also delete
Date: Fri, 23 Sep 2011 10:56:00 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105888
author: Peter J. Weisberg <address@hidden>
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2011-09-23 10:56:00 -0400
message:
  * lisp/simple.el (delete-trailing-whitespace): Also delete
  extra newlines at the end of the buffer.
modified:
  lisp/ChangeLog
  lisp/simple.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-09-23 14:47:01 +0000
+++ b/lisp/ChangeLog    2011-09-23 14:56:00 +0000
@@ -1,5 +1,8 @@
 2011-09-23  Peter J. Weisberg  <address@hidden>
 
+       * 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.
 

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2011-09-23 10:52:23 +0000
+++ b/lisp/simple.el    2011-09-23 14:56:00 +0000
@@ -586,6 +586,12 @@
             (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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]