GNU bug report logs - #38219
Error on leaving Ediff after killing vital buffer

Previous Next

Package: emacs;

Reported by: Richard Copley <rcopley <at> gmail.com>

Date: Fri, 15 Nov 2019 13:52:02 UTC

Severity: normal

Done: Juri Linkov <juri <at> linkov.net>

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 38219 in the body.
You can then email your comments to 38219 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#38219; Package emacs. (Fri, 15 Nov 2019 13:52:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Richard Copley <rcopley <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 15 Nov 2019 13:52:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Richard Copley <rcopley <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Error on leaving Ediff after killing vital buffer
Date: Fri, 15 Nov 2019 13:50:32 +0000
[Message part 1 (text/plain, inline)]
If you kill one of Ediff's vital buffers, then try to leave Ediff (by
typing q in the control window), there is an error.

The error is:
ediff-visible-region: You have killed a vital Ediff buffer---you must leave
Ediff now!

Recipe from 'emacs -Q' (Windows GUI build):

* Visit a file under version control with unstaged changes.
* [M-x ediff-revision RET RET RET RET]
* In the main frame, kill one of the buffers being diffed
* In the Ediff control window frame, type [q y]

Bisected to this commit:

a26a8cc1c85f29fb11209c16d53a8ae4e4ab7ced
Author: Juri Linkov <juri <at> linkov.net>
Date: Sun Nov 10 00:04:13 2019 +0200

'y-or-n-p' now uses the minibuffer to read 'y' or 'n' answer (bug#38076)
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38219; Package emacs. (Fri, 15 Nov 2019 16:37:02 GMT) Full text and rfc822 format available.

Message #8 received at 38219 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Richard Copley <rcopley <at> gmail.com>, 38219 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#38219: Error on leaving Ediff after killing vital buffer
Date: Fri, 15 Nov 2019 17:35:58 +0100
[Message part 1 (text/plain, inline)]
> If you kill one of Ediff's vital buffers, then try to leave Ediff (by
> typing q in the control window), there is an error.
>
> The error is:
> ediff-visible-region: You have killed a vital Ediff buffer---you must leave
> Ediff now!

'y-or-n-p' mangles 'this-command'.  Something like the attached patch
should fix that.

martin
[subr.el.diffs (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38219; Package emacs. (Sat, 16 Nov 2019 21:08:03 GMT) Full text and rfc822 format available.

Message #11 received at 38219 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Richard Copley <rcopley <at> gmail.com>, 38219 <at> debbugs.gnu.org
Subject: Re: bug#38219: Error on leaving Ediff after killing vital buffer
Date: Sat, 16 Nov 2019 22:18:24 +0200
> 'y-or-n-p' mangles 'this-command'.  Something like the attached patch
> should fix that.

Can the same be said about read-from-minibuffer?
Shouldn't read-from-minibuffer mangle 'this-command'?
What it some command wants to check if 'this-command'
is 'exit-minibuffer' afterwards?  Shouldn't this change better
to be localized to callers in ediff, instead of adding such hack?

> diff --git a/lisp/subr.el b/lisp/subr.el
> index eaec223585..68e25c96d9 100644
> --- a/lisp/subr.el
> +++ b/lisp/subr.el
> @@ -2828,7 +2828,8 @@ y-or-n-p
>  		    (concat prompt
>  			    (if (or (zerop l) (eq ?\s (aref prompt (1- l))))
>  				"" " ")
> -			    (if dialog "" "(y or n) "))))))
> +			    (if dialog "" "(y or n) ")))))
> +        (old-this-command this-command))
>      (cond
>       (noninteractive
>        (setq prompt (funcall padded prompt))
> @@ -2858,6 +2859,7 @@ y-or-n-p
>      (let ((ret (eq answer 'act)))
>        (unless noninteractive
>          (message "%s%c" prompt (if ret ?y ?n)))
> +      (setq this-command old-this-command)
>        ret)))
>  
>  




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38219; Package emacs. (Sun, 17 Nov 2019 09:03:02 GMT) Full text and rfc822 format available.

Message #14 received at 38219 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: Richard Copley <rcopley <at> gmail.com>, 38219 <at> debbugs.gnu.org
Subject: Re: bug#38219: Error on leaving Ediff after killing vital buffer
Date: Sun, 17 Nov 2019 10:02:06 +0100
> Can the same be said about read-from-minibuffer?
> Shouldn't read-from-minibuffer mangle 'this-command'?
> What it some command wants to check if 'this-command'
> is 'exit-minibuffer' afterwards?  Shouldn't this change better
> to be localized to callers in ediff, instead of adding such hack?

You could argue that 'ediff' already breaks

(defalias 'y-or-n-p 'yes-or-no-p)

They would probably say that consulting 'this-command' after a
'y-or-n-p' "has worked ever since".  Guess whose argument wins.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38219; Package emacs. (Sun, 17 Nov 2019 21:32:02 GMT) Full text and rfc822 format available.

Message #17 received at 38219 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Richard Copley <rcopley <at> gmail.com>, 38219 <at> debbugs.gnu.org
Subject: Re: bug#38219: Error on leaving Ediff after killing vital buffer
Date: Sun, 17 Nov 2019 23:28:36 +0200
> You could argue that 'ediff' already breaks
>
> (defalias 'y-or-n-p 'yes-or-no-p)
>
> They would probably say that consulting 'this-command' after a
> 'y-or-n-p' "has worked ever since".  Guess whose argument wins.

Good example.  This means that 'ediff' is broken, here is the fix:

diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el
index a481defe29..c85241b2ea 100644
--- a/lisp/vc/ediff-util.el
+++ b/lisp/vc/ediff-util.el
@@ -1038,6 +1038,7 @@ ediff-toggle-read-only
 			 (format
 			  "File %s is under version control.  Check it out? "
 			  (ediff-abbreviate-file-name file))))
+                   (setq this-command 'ediff-toggle-read-only)
 		   ;; if we checked the file out, we should also change the
 		   ;; original state of buffer-read-only to nil.  If we don't
 		   ;; do this, the mode line will show %%, since the file was
@@ -2379,6 +2380,7 @@ ediff-quit
 			      " & show containing session group" "")))
 	(progn
 	  (message "")
+          (setq this-command 'ediff-quit)
 	  (set-buffer ctl-buf)
 	  (ediff-really-quit reverse-default-keep-variants))
       (select-frame ctl-frm)




Reply sent to Juri Linkov <juri <at> linkov.net>:
You have taken responsibility. (Mon, 18 Nov 2019 21:55:02 GMT) Full text and rfc822 format available.

Notification sent to Richard Copley <rcopley <at> gmail.com>:
bug acknowledged by developer. (Mon, 18 Nov 2019 21:55:11 GMT) Full text and rfc822 format available.

Message #22 received at 38219-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Richard Copley <rcopley <at> gmail.com>, 38219-done <at> debbugs.gnu.org
Subject: Re: bug#38219: Error on leaving Ediff after killing vital buffer
Date: Mon, 18 Nov 2019 23:53:29 +0200
>> You could argue that 'ediff' already breaks
>>
>> (defalias 'y-or-n-p 'yes-or-no-p)
>>
>> They would probably say that consulting 'this-command' after a
>> 'y-or-n-p' "has worked ever since".  Guess whose argument wins.
>
> Good example.  This means that 'ediff' is broken, here is the fix:

Now pushed and closed. 




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 17 Dec 2019 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 190 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.