emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 e35a08e: Prevent infloop in 'delete-trailing-whit


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-26 e35a08e: Prevent infloop in 'delete-trailing-whitespace'
Date: Mon, 4 Jun 2018 12:33:48 -0400 (EDT)

branch: emacs-26
commit e35a08ea4bdf08a22c89ec84948fd3db44f6850c
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Prevent infloop in 'delete-trailing-whitespace'
    
    * lisp/simple.el (delete-trailing-whitespace): Avoid inflooping
    when some region of trailing whitespace is unmodifiable.
    (Bug#31557)
---
 lisp/simple.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index 9483170..bcf2b06 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -639,8 +639,9 @@ buffer if the variable `delete-trailing-lines' is non-nil."
           (while (re-search-forward "\\s-$" end-marker t)
             (skip-syntax-backward "-" (line-beginning-position))
             (let ((b (point)) (e (match-end 0)))
-              (when (region-modifiable-p b e)
-                (delete-region b e)))))
+              (if (region-modifiable-p b e)
+                  (delete-region b e)
+                (goto-char e)))))
         (if end
             (set-marker end-marker nil)
           ;; Delete trailing empty lines.



reply via email to

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