From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <1d859e63-53ea-bb90-7feb-b864d023e88e@weblogism.com> <87sg67m4s3.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11741"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, 46373@debbugs.gnu.org, =?UTF-8?Q?S=C3=A9bastien?= Le Callonnec To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 08 19:52:45 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9BeP-0002x2-O2 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 08 Feb 2021 19:52:45 +0100 Original-Received: from localhost ([::1]:45404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9BeO-0003iH-Qv for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 08 Feb 2021 13:52:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l95UR-0008OV-7s for bug-gnu-emacs@gnu.org; Mon, 08 Feb 2021 07:18:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38453) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l95UQ-0002pV-2A for bug-gnu-emacs@gnu.org; Mon, 08 Feb 2021 07:18:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l95UP-0003Rp-Th for bug-gnu-emacs@gnu.org; Mon, 08 Feb 2021 07:18:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Feb 2021 12:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46373 X-GNU-PR-Package: emacs Original-Received: via spool by 46373-submit@debbugs.gnu.org id=B46373.161278664713204 (code B ref 46373); Mon, 08 Feb 2021 12:18:01 +0000 Original-Received: (at 46373) by debbugs.gnu.org; 8 Feb 2021 12:17:27 +0000 Original-Received: from localhost ([127.0.0.1]:49997 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l95Tq-0003Qu-RH for submit@debbugs.gnu.org; Mon, 08 Feb 2021 07:17:27 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:34874 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1l95Tm-0003Qc-Ig for 46373@debbugs.gnu.org; Mon, 08 Feb 2021 07:17:24 -0500 Original-Received: (qmail 23396 invoked by uid 3782); 8 Feb 2021 12:17:15 -0000 Original-Received: from acm.muc.de (p4fe15ad3.dip0.t-ipconnect.de [79.225.90.211]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 08 Feb 2021 13:17:15 +0100 Original-Received: (qmail 24225 invoked by uid 1000); 8 Feb 2021 12:17:15 -0000 Content-Disposition: inline In-Reply-To: <87sg67m4s3.fsf@gnus.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:199608 Archived-At: Hello, Lars and Sébastien. On Mon, Feb 08, 2021 at 07:50:52 +0100, Lars Ingebrigtsen wrote: > Sébastien Le Callonnec 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).