Subject: Re: bug#38219: Error on leaving Ediff after killing vital buffer

From: martin rudalics <[email-masked]>
Date: Fri, 15 Nov 2019 17:35:58 +0100

> 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
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)))