Commit b3c0fb21 authored by Juri Linkov's avatar Juri Linkov

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.
parent 6960a754
Pipeline #4174 failed with stage
in 82 minutes and 19 seconds
...@@ -2847,6 +2847,7 @@ is nil and `use-dialog-box' is non-nil." ...@@ -2847,6 +2847,7 @@ is nil and `use-dialog-box' is non-nil."
(t (t
(setq prompt (funcall padded prompt)) (setq prompt (funcall padded prompt))
(let* ((empty-history '()) (let* ((empty-history '())
(enable-recursive-minibuffers t)
(str (read-from-minibuffer (str (read-from-minibuffer
prompt nil prompt nil
(make-composed-keymap y-or-n-p-map query-replace-map) (make-composed-keymap y-or-n-p-map query-replace-map)
......
...@@ -2805,15 +2805,18 @@ if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil. */) ...@@ -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) "); AUTO_STRING (yes_or_no, "(yes or no) ");
prompt = CALLN (Fconcat, prompt, yes_or_no); prompt = CALLN (Fconcat, prompt, yes_or_no);
ptrdiff_t count = SPECPDL_INDEX ();
specbind (Qenable_recursive_minibuffers, Qt);
while (1) while (1)
{ {
ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil,
Qyes_or_no_p_history, Qnil, Qyes_or_no_p_history, Qnil,
Qnil)); Qnil));
if (SCHARS (ans) == 3 && !strcmp (SSDATA (ans), "yes")) if (SCHARS (ans) == 3 && !strcmp (SSDATA (ans), "yes"))
return Qt; return unbind_to (count, Qt);
if (SCHARS (ans) == 2 && !strcmp (SSDATA (ans), "no")) if (SCHARS (ans) == 2 && !strcmp (SSDATA (ans), "no"))
return Qnil; return unbind_to (count, Qnil);
Fding (Qnil); Fding (Qnil);
Fdiscard_input (); Fdiscard_input ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment