unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: "João Távora" <joaotavora@gmail.com>
Cc: Michael Heerdegen <michael_heerdegen@web.de>,
	17272@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>,
	19064@debbugs.gnu.org
Subject: bug#17272: bug#19064: bug#17272: bug#19064: bug#17272: bug#19064: 25.0.50; `message' overwrites `y-or-n-p' prompt, so user misses it
Date: Thu, 21 Nov 2019 00:10:59 +0200	[thread overview]
Message-ID: <87v9reqk6o.fsf@mail.linkov.net> (raw)
In-Reply-To: <CALDnm53hN3QBNxqOdVNZLpShNgEAXC-rWyyHo6P0=87JDe4JZQ@mail.gmail.com> ("João Távora"'s message of "Tue, 19 Nov 2019 23:38:20 +0000")

> Emacs -Q
> M-x fido-mode
> (defalias 'yes-or-no-p 'y-or-n-p) ;; a common custmization
> C-x b
> C-k ;; to kill the Messages buffer
>
> Before your changes to `y-or-n-p` this worked well, afterwards
> I get the "Attempt to use minibuffer inside minibuffer" error.
>
> Bear in mind that fido-mode is very new. Also bear in mind
> that the problem is already present when yes-or-no-p is used.
>
> I think a good fix is for icomplete to do this (and for
> you to do nothing :-) )

It's tempting to do nothing :-), but since the problem is
already present with yes-or-no-p too, it should be fixed
because it's a general problem affecting other commands too.

The nil value of enable-recursive-minibuffers by default was intended
to avoid confusion for beginners unadvisedly typing such sequences as
M-x M-x M-x M-x M-x ... to get out from which is not easy.

But for yes/no or y/n questions it should be right to
allow recursive minibuffers temporarily:

diff --git a/lisp/subr.el b/lisp/subr.el
index 20daed623f..2265965c60 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2847,6 +2848,7 @@ y-or-n-p
      (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 cbb6879223..3ae3192b3d 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2805,15 +2805,18 @@ DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0,
   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	other threads:[~2019-11-20 22:10 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-15 18:38 bug#19064: 25.0.50; `message' overwrites `y-or-n-p' prompt, so user misses it Drew Adams
2015-12-26 16:30 ` Lars Ingebrigtsen
2015-12-26 17:19   ` Drew Adams
2015-12-26 17:45     ` Michael Heerdegen
2015-12-26 17:57       ` Lars Ingebrigtsen
2019-10-07 17:41         ` bug#17272: " Lars Ingebrigtsen
2019-10-08  9:15           ` Michael Heerdegen
2019-10-08 15:44             ` bug#17272: " Lars Ingebrigtsen
2019-11-05 23:10           ` bug#19064: " Juri Linkov
2019-11-08 20:58             ` Lars Ingebrigtsen
2019-11-08 21:19               ` bug#19064: " Drew Adams
2019-11-09 23:01               ` Juri Linkov
2019-11-12  2:13                 ` bug#17272: " Lars Ingebrigtsen
2019-11-12 15:34                   ` Drew Adams
2019-11-12 22:20                     ` Juri Linkov
2019-11-12 23:23                       ` bug#17272: " Drew Adams
2019-11-13 21:29                     ` Michael Heerdegen
2019-11-13 21:53                       ` Juri Linkov
2019-11-13 23:24                       ` bug#17272: " Drew Adams
2019-11-14 15:46                         ` Michael Heerdegen
2019-11-14 16:28                           ` bug#17272: " Drew Adams
2019-11-14 17:06                             ` Michael Heerdegen
2019-11-14 17:17                               ` Drew Adams
2019-11-14 20:29                                 ` Michael Heerdegen
2019-11-16 20:53                                   ` Juri Linkov
2019-11-16 22:37                                     ` Michael Heerdegen
2019-11-17  1:42                                       ` bug#19064: bug#17272: " Drew Adams
2019-11-17 21:58                                         ` Juri Linkov
2019-11-17 23:54                                           ` bug#19064: " Drew Adams
2019-11-17  5:52                                     ` Lars Ingebrigtsen
2019-11-17  5:52                                     ` Lars Ingebrigtsen
2019-11-17 21:59                                       ` bug#17272: " Juri Linkov
2019-11-18 21:10                                         ` Juri Linkov
2019-11-19  8:13                                           ` Lars Ingebrigtsen
2019-11-19 11:11                                             ` bug#19064: " João Távora
2019-11-19 22:39                                               ` bug#17272: " Juri Linkov
2019-11-19 23:38                                                 ` João Távora
2019-11-20 22:10                                                   ` Juri Linkov [this message]
2019-11-20 23:44                                                     ` João Távora
2019-11-21 21:39                                                       ` Juri Linkov
2019-11-22  7:48                                                         ` Eli Zaretskii
2019-11-23 19:02                                                           ` Juri Linkov
2019-11-23 19:14                                                             ` Eli Zaretskii
2019-11-26 23:18                                                               ` bug#19064: " Juri Linkov
2019-11-27  0:46                                                                 ` Drew Adams
2019-11-21  8:22                                                     ` martin rudalics
2019-11-21 21:44                                                       ` Juri Linkov
2019-11-22  8:08                                                         ` martin rudalics
2019-11-23 18:56                                                           ` Juri Linkov
2019-11-23 19:16                                                             ` Eli Zaretskii
2019-11-19 22:28                                             ` Juri Linkov
2019-11-20 10:55                                               ` Lars Ingebrigtsen
2019-11-20 22:18                                                 ` Juri Linkov
2019-11-21 21:54                                                   ` Juri Linkov
2019-11-21 23:07                                                     ` bug#19064: " Lars Ingebrigtsen
2019-11-23 21:54                                               ` Juri Linkov
2019-11-26 23:44                                                 ` Juri Linkov
2019-11-27 11:55                                                   ` bug#19064: " Lars Ingebrigtsen
2019-11-28 22:45                                                     ` Juri Linkov
2019-11-06 22:18       ` Juri Linkov
2019-11-09 22:57       ` Juri Linkov
2019-11-10  9:46         ` martin rudalics
2019-11-10 20:45           ` bug#38164: quit-restore-window doesn't restore point in man Juri Linkov
2019-11-11  9:33             ` martin rudalics
2019-11-12 20:50               ` Juri Linkov
2019-11-13  8:04                 ` martin rudalics
2019-11-13 21:29                   ` Juri Linkov
2019-11-14  9:20                     ` martin rudalics
2019-11-14 23:13                       ` Juri Linkov
2019-11-15  8:13                         ` martin rudalics
2019-11-18 21:21                           ` Juri Linkov
2019-11-19  3:28                             ` Eli Zaretskii
2019-11-19  7:56                               ` martin rudalics
2019-11-19 16:06                                 ` Eli Zaretskii
2019-11-19 16:53                                   ` martin rudalics
2019-11-19 17:36                                     ` Eli Zaretskii
2019-11-19 18:15                                       ` martin rudalics
2019-11-19 23:03                                     ` Juri Linkov
2019-11-20  7:59                                       ` martin rudalics
2019-11-20 22:35                                         ` Juri Linkov
2019-11-20 16:02                                       ` Eli Zaretskii
2020-09-21 13:08                 ` Lars Ingebrigtsen
2021-04-04 18:13                   ` Basil L. Contovounesios
2021-04-04 18:28                     ` Eli Zaretskii
2021-04-04 19:19                       ` Lars Ingebrigtsen
2021-04-04 19:36                         ` Eli Zaretskii
2021-04-04 19:40                           ` Lars Ingebrigtsen
2021-04-04 19:38                         ` Lars Ingebrigtsen
2015-12-26 17:53     ` bug#19064: 25.0.50; `message' overwrites `y-or-n-p' prompt, so user misses it Lars Ingebrigtsen
2015-12-26 18:10     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v9reqk6o.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=17272@debbugs.gnu.org \
    --cc=19064@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=larsi@gnus.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).