emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 4e8448b4bc: Allow commands that call `yes-or-no-p' to be repeatab


From: Lars Ingebrigtsen
Subject: master 4e8448b4bc: Allow commands that call `yes-or-no-p' to be repeatable again
Date: Mon, 11 Jul 2022 08:56:12 -0400 (EDT)

branch: master
commit 4e8448b4bc5aae297c053080bc04208f5a0793e8
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Allow commands that call `yes-or-no-p' to be repeatable again
    
    * 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 | 7 +++++--
 src/fns.c    | 5 +++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index f8b386e563..ef2edcff10 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -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))
diff --git a/src/fns.c b/src/fns.c
index eb83471649..1f57e675b1 100644
--- 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");
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]