emacs-diffs
[Top][All Lists]
Advanced

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

master b3c0fb2: Allow recursive minibuffers for yes-or-no-p and y-or-n-p


From: Juri Linkov
Subject: master b3c0fb2: Allow recursive minibuffers for yes-or-no-p and y-or-n-p (bug#17272 bug#19064)
Date: Tue, 26 Nov 2019 18:18:25 -0500 (EST)

branch: master
commit b3c0fb21bd910f5d86490154451cc324ce9ad66b
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    Allow recursive minibuffers for yes-or-no-p and y-or-n-p (bug#17272 
bug#19064)
    
    * lisp/subr.el (y-or-n-p): Let-bind enable-recursive-minibuffers to t.
    
    * src/fns.c (Fyes_or_no_p): Specbind Qenable_recursive_minibuffers to Qt.
---
 lisp/subr.el | 1 +
 src/fns.c    | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index fe55566..01f4f53 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2847,6 +2847,7 @@ is nil and `use-dialog-box' is non-nil."
      (t
       (setq prompt (funcall padded prompt))
       (let* ((empty-history '())
+             (enable-recursive-minibuffers t)
              (str (read-from-minibuffer
                    prompt nil
                    (make-composed-keymap y-or-n-p-map query-replace-map)
diff --git a/src/fns.c b/src/fns.c
index cbb6879..3ae3192 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2805,15 +2805,18 @@ if `last-nonmenu-event' is nil, and `use-dialog-box' is 
non-nil.  */)
   AUTO_STRING (yes_or_no, "(yes or no) ");
   prompt = CALLN (Fconcat, prompt, yes_or_no);
 
+  ptrdiff_t count = SPECPDL_INDEX ();
+  specbind (Qenable_recursive_minibuffers, Qt);
+
   while (1)
     {
       ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil,
                                              Qyes_or_no_p_history, Qnil,
                                              Qnil));
       if (SCHARS (ans) == 3 && !strcmp (SSDATA (ans), "yes"))
-       return Qt;
+       return unbind_to (count, Qt);
       if (SCHARS (ans) == 2 && !strcmp (SSDATA (ans), "no"))
-       return Qnil;
+       return unbind_to (count, Qnil);
 
       Fding (Qnil);
       Fdiscard_input ();



reply via email to

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