Prevent infloop in 'delete-trailing-whitespace'
* lisp/simple.el (delete-trailing-whitespace): Avoid inflooping when some region of trailing whitespace is unmodifiable. (Bug#31557)
This commit is contained in:
parent
5d448ca98c
commit
e35a08ea4b
1 changed files with 3 additions and 2 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue