[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#31557: 27.0.50; SES hangs on save when 'delete-trailing-whitespace'
From: |
Noam Postavsky |
Subject: |
bug#31557: 27.0.50; SES hangs on save when 'delete-trailing-whitespace' is in 'before-save-hook' |
Date: |
Sun, 03 Jun 2018 12:05:34 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
> If my reading of the code is correct, it should infloop for every use
> case where region-modifiable-p returns nil.
Yes, agreed.
> Does the patch below look right?
>
> --- lisp/simple.el~0 2018-03-14 06:40:04.000000000 +0200
> +++ lisp/simple.el 2018-06-03 17:51:37.213490900 +0300
> @@ -667,8 +667,9 @@
> (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)))))
Looks good to me.