]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow commands that call `yes-or-no-p' to be repeatable again
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 11 Jul 2022 12:51:34 +0000 (14:51 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 11 Jul 2022 12:56:06 +0000 (14:56 +0200)
* lisp/subr.el (y-or-n-p): Enable commands that call this function
to be repeatable (bug#45999).  This stopped working after this
function started using read-from-minibuffer.
* src/fns.c (Fyes_or_no_p): Ditto.

lisp/subr.el
src/fns.c

index f8b386e56313e6d36a1b1852789f5a51ce170a31..ef2edcff102447e89b296ed61485594d8f32a71f 100644 (file)
@@ -3482,8 +3482,11 @@ like) while `y-or-n-p' is running)."
                                   (format "(y, n or %s) "
                                          (key-description
                                            (vector help-char)))
-                                  "(y or n) "
-                                  )))))))
+                                "(y or n) "))))))
+        ;; Preserve the actual command that eventually called
+        ;; `y-or-n-p' (otherwise `repeat' will be repeating
+        ;; `exit-minibuffer').
+        (real-this-command real-this-command))
     (cond
      (noninteractive
       (setq prompt (funcall padded prompt))
index eb83471649e5c3b93bc73846acbefe05df89ecee..1f57e675b12f6466a38048a64dab6c8733cd3e5a 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -2975,6 +2975,9 @@ if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil.  */)
 
   specpdl_ref count = SPECPDL_INDEX ();
   specbind (Qenable_recursive_minibuffers, Qt);
+  /* Preserve the actual command that eventually called `yes-or-no-p'
+     (otherwise `repeat' will be repeating `exit-minibuffer').  */
+  specbind (Qreal_this_command, Vreal_this_command);
 
   while (1)
     {
@@ -6129,4 +6132,6 @@ The same variable also affects the function `read-answer'.  */);
   defsubr (&Sbuffer_hash);
   defsubr (&Slocale_info);
   defsubr (&Sbuffer_line_statistics);
+
+  DEFSYM (Qreal_this_command, "real-this-command");
 }