Minor code tweak for delete-trailing-whitespace.
authorChong Yidong <cyd@gnu.org>
Sun, 30 Sep 2012 08:41:37 +0000 (16:41 +0800)
committerChong Yidong <cyd@gnu.org>
Sun, 30 Sep 2012 08:41:37 +0000 (16:41 +0800)
* lisp/simple.el (delete-trailing-whitespace): Avoid an unnecessary
restriction change.

lisp/ChangeLog
lisp/simple.el

index f9a81c2..65ff71c 100644 (file)
@@ -1,5 +1,8 @@
 2012-09-30  Chong Yidong  <cyd@gnu.org>
 
+       * simple.el (delete-trailing-whitespace): Avoid an unnecessary
+       restriction change.
+
        * bindings.el (goto-map): Bind M-g TAB to move-to-column.
 
        * help-fns.el (help-fns--obsolete): Fix last change.
index 417dedb..616a4d7 100644 (file)
@@ -606,7 +606,7 @@ buffer if the variable `delete-trailing-lines' is non-nil."
         (when (and (not end)
                   delete-trailing-lines
                    ;; Really the end of buffer.
-                   (save-restriction (widen) (eobp))
+                  (= (point-max) (1+ (buffer-size)))
                    (<= (skip-chars-backward "\n") -2))
           (delete-region (1+ (point)) end-marker))
         (set-marker end-marker nil))))