diff options
| author | Juri Linkov | 2019-11-27 01:18:17 +0200 |
|---|---|---|
| committer | Juri Linkov | 2019-11-27 01:18:17 +0200 |
| commit | b3c0fb21bd910f5d86490154451cc324ce9ad66b (patch) | |
| tree | b1a02c46a12013510ff46d065f8340ff73bcd0e0 | |
| parent | 6960a7543cef8cadc2cb9c20d3f21983ed71621a (diff) | |
| download | emacs-b3c0fb21bd910f5d86490154451cc324ce9ad66b.tar.gz emacs-b3c0fb21bd910f5d86490154451cc324ce9ad66b.zip | |
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.
| -rw-r--r-- | lisp/subr.el | 1 | ||||
| -rw-r--r-- | src/fns.c | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index fe55566b52d..01f4f531b14 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -2847,6 +2847,7 @@ is nil and `use-dialog-box' is non-nil." | |||
| 2847 | (t | 2847 | (t |
| 2848 | (setq prompt (funcall padded prompt)) | 2848 | (setq prompt (funcall padded prompt)) |
| 2849 | (let* ((empty-history '()) | 2849 | (let* ((empty-history '()) |
| 2850 | (enable-recursive-minibuffers t) | ||
| 2850 | (str (read-from-minibuffer | 2851 | (str (read-from-minibuffer |
| 2851 | prompt nil | 2852 | prompt nil |
| 2852 | (make-composed-keymap y-or-n-p-map query-replace-map) | 2853 | (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 | AUTO_STRING (yes_or_no, "(yes or no) "); | 2805 | AUTO_STRING (yes_or_no, "(yes or no) "); |
| 2806 | prompt = CALLN (Fconcat, prompt, yes_or_no); | 2806 | prompt = CALLN (Fconcat, prompt, yes_or_no); |
| 2807 | 2807 | ||
| 2808 | ptrdiff_t count = SPECPDL_INDEX (); | ||
| 2809 | specbind (Qenable_recursive_minibuffers, Qt); | ||
| 2810 | |||
| 2808 | while (1) | 2811 | while (1) |
| 2809 | { | 2812 | { |
| 2810 | ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, | 2813 | ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, |
| 2811 | Qyes_or_no_p_history, Qnil, | 2814 | Qyes_or_no_p_history, Qnil, |
| 2812 | Qnil)); | 2815 | Qnil)); |
| 2813 | if (SCHARS (ans) == 3 && !strcmp (SSDATA (ans), "yes")) | 2816 | if (SCHARS (ans) == 3 && !strcmp (SSDATA (ans), "yes")) |
| 2814 | return Qt; | 2817 | return unbind_to (count, Qt); |
| 2815 | if (SCHARS (ans) == 2 && !strcmp (SSDATA (ans), "no")) | 2818 | if (SCHARS (ans) == 2 && !strcmp (SSDATA (ans), "no")) |
| 2816 | return Qnil; | 2819 | return unbind_to (count, Qnil); |
| 2817 | 2820 | ||
| 2818 | Fding (Qnil); | 2821 | Fding (Qnil); |
| 2819 | Fdiscard_input (); | 2822 | Fdiscard_input (); |