unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: acm@muc.de, 46373@debbugs.gnu.org,
	"Sébastien Le Callonnec" <sebastien@weblogism.com>
Subject: bug#46373: 28.0.50; "Not in most nested minibuffer" error when selecting date in calendar
Date: Mon, 8 Feb 2021 12:17:15 +0000	[thread overview]
Message-ID: <YCEry9YuNDmHtrQ0@ACM> (raw)
In-Reply-To: <87sg67m4s3.fsf@gnus.org>

Hello, Lars and Sébastien.

On Mon, Feb 08, 2021 at 07:50:52 +0100, Lars Ingebrigtsen wrote:
> Sébastien Le Callonnec <sebastien@weblogism.com> writes:

> > Debugger entered--Lisp error: (error "Not in most nested minibuffer")
> > signal(error ("Not in most nested minibuffer"))

> [...]

> > Here are the steps to reproduce the issue following `emacs -Q`:

> > M-: (setq debug-on-error t) RET
> > C-x C-f /tmp/example.org RET
> > C-c .
> > Click on date in calendar

> > git bisect indicates commit c7c154bb5756e0ae71d342c5d8aabf725877f186
> > is the first bad commit

> An even simpler method to reproduce:

> `M-x org-time-stamp RET'

> then mouse-click on one of the dates in the calendar buffer.

Sorry about the misunderstanding.  I'd neglected the case when
exit-minibuffer is called from Lisp code rather than from a keybinding.
Please try out the following patch, which I think fixes this bug:



diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 185d355ba7..b60775d457 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -2393,7 +2393,7 @@ Minibuffer Commands
 @deffn Command exit-minibuffer
 This command exits the active minibuffer.  It is normally bound to
 keys in minibuffer local keymaps.  The command throws an error if the
-current buffer is not the active minibuffer.
+current buffer is a minibuffer, but not the active minibuffer.
 @end deffn
 
 @deffn Command self-insert-and-exit
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 03cc70c0d4..a899a943d4 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2116,13 +2116,15 @@ minibuffer-hide-completions
 (defun exit-minibuffer ()
   "Terminate this minibuffer argument."
   (interactive)
+  (when (or
+         (innermost-minibuffer-p)
+         (not (minibufferp)))
   ;; If the command that uses this has made modifications in the minibuffer,
   ;; we don't want them to cause deactivation of the mark in the original
   ;; buffer.
   ;; A better solution would be to make deactivate-mark buffer-local
   ;; (or to turn it into a list of buffers, ...), but in the mean time,
   ;; this should do the trick in most cases.
-  (when (innermost-minibuffer-p)
     (setq deactivate-mark nil)
     (throw 'exit nil))
   (error "%s" "Not in most nested minibuffer"))


> I've added Alan to the CCs since c7c154bb5 is his change.

Thanks!

> -- 
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2021-02-08 12:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-07 21:27 bug#46373: 28.0.50; "Not in most nested minibuffer" error when selecting date in calendar Sébastien Le Callonnec
2021-02-08  6:50 ` Lars Ingebrigtsen
2021-02-08 12:17   ` Alan Mackenzie [this message]
2021-02-08 13:54     ` Sébastien Le Callonnec
2021-02-09  9:51       ` Alan Mackenzie
2021-02-09 12:55         ` Sébastien Le Callonnec

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=YCEry9YuNDmHtrQ0@ACM \
    --to=acm@muc.de \
    --cc=46373@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=sebastien@weblogism.com \
    /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).