From: Lars Ingebrigtsen Date: Mon, 11 Jul 2022 12:51:34 +0000 (+0200) Subject: Allow commands that call `yes-or-no-p' to be repeatable again X-Git-Tag: emacs-29.0.90~1447^2~1011 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4e8448b4bc5aae297c053080bc04208f5a0793e8;p=emacs.git 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. --- diff --git a/lisp/subr.el b/lisp/subr.el index f8b386e5631..ef2edcff102 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 eb83471649e..1f57e675b12 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"); }