GNU bug report logs -
#31557
27.0.50; SES hangs on save when 'delete-trailing-whitespace' is in 'before-save-hook'
Previous Next
Reported by: Filipp Gunbin <fgunbin <at> fastmail.fm>
Date: Tue, 22 May 2018 17:55:02 UTC
Severity: normal
Merged with 32633
Found in versions 26.1, 27.0.50
Fixed in version 26.2
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31557 in the body.
You can then email your comments to 31557 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31557
; Package
emacs
.
(Tue, 22 May 2018 17:55:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Filipp Gunbin <fgunbin <at> fastmail.fm>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 22 May 2018 17:55:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
emacs -Q
M-: (add-hook 'before-save-hook #'delete-trailing-whitespace)
C-x C-f ~/tmp/1.ses (file does not exist)
C-x C-s
At this point emacs hangs, echo area shows "Saving file .../1.ses".
With `toggle-error-on-quit', I see the following backtrace:
re-search-forward("\\s-$" nil t)
delete-trailing-whitespace()
run-hooks(before-save-hook)
basic-save-buffer(t)
save-buffer(1)
funcall-interactively(save-buffer 1)
call-interactively(save-buffer nil nil)
command-execute(save-buffer)
In GNU Emacs 27.0.50 (build 10, x86_64-apple-darwin17.5.0)
of 2018-05-14 built on fgunbin.playteam.ru
Repository revision: 15fa8de1ae3228413fde95e583008d9b9f19e7c7
System Description: Mac OS X 10.13.4
Configured using:
'configure CC=/usr/bin/gcc --without-all --without-ns --with-dbus
--with-file-notification=no --with-gnutls --with-modules --with-threads
--with-xml2 --with-zlib --without-x'
Configured features:
GNUTLS LIBXML2 ZLIB MODULES THREADS
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31557
; Package
emacs
.
(Sun, 03 Jun 2018 15:45:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 31557 <at> debbugs.gnu.org (full text, mbox):
> From: Filipp Gunbin <fgunbin <at> fastmail.fm>
> Date: Tue, 22 May 2018 20:53:55 +0300
>
>
> emacs -Q
> M-: (add-hook 'before-save-hook #'delete-trailing-whitespace)
> C-x C-f ~/tmp/1.ses (file does not exist)
> C-x C-s
>
> At this point emacs hangs, echo area shows "Saving file .../1.ses".
>
> With `toggle-error-on-quit', I see the following backtrace:
>
> re-search-forward("\\s-$" nil t)
> delete-trailing-whitespace()
> run-hooks(before-save-hook)
> basic-save-buffer(t)
> save-buffer(1)
> funcall-interactively(save-buffer 1)
> call-interactively(save-buffer nil nil)
> command-execute(save-buffer)
If my reading of the code is correct, it should infloop for every use
case where region-modifiable-p returns nil.
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)))))
(if end
(set-marker end-marker nil)
;; Delete trailing empty lines.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31557
; Package
emacs
.
(Sun, 03 Jun 2018 16:06:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 31557 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31557
; Package
emacs
.
(Mon, 04 Jun 2018 14:28:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 31557 <at> debbugs.gnu.org (full text, mbox):
On 03/06/2018 12:05 -0400, Noam Postavsky wrote:
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>> Does the patch below look right?
>> ...
>
> Looks good to me.
And also to me. Thanks!
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Mon, 04 Jun 2018 16:35:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Filipp Gunbin <fgunbin <at> fastmail.fm>
:
bug acknowledged by developer.
(Mon, 04 Jun 2018 16:35:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 31557-done <at> debbugs.gnu.org (full text, mbox):
> From: Filipp Gunbin <fgunbin <at> fastmail.fm>
> Cc: 31557 <at> debbugs.gnu.org
> Date: Mon, 04 Jun 2018 17:26:58 +0300
>
> On 03/06/2018 12:05 -0400, Noam Postavsky wrote:
>
> > Eli Zaretskii <eliz <at> gnu.org> writes:
> >
> >> Does the patch below look right?
> >> ...
> >
> > Looks good to me.
>
> And also to me. Thanks!
Thanks for testing. I installed this on the emacs-26 branch, and I'm
closing the bug.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 03 Jul 2018 11:24:04 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Mon, 10 Sep 2018 19:33:02 GMT)
Full text and
rfc822 format available.
Forcibly Merged 31557 32633.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Mon, 10 Sep 2018 19:33:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 09 Oct 2018 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 186 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.