GNU bug report logs - #56425
28.1; post-command-hook is triggered on y-or-n-p

Previous Next

Package: emacs;

Reported by: Bhavin Gandhi <bhavin7392 <at> gmail.com>

Date: Wed, 6 Jul 2022 17:57:02 UTC

Severity: normal

Tags: notabug

Found in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #21 received at 56425 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: bhavin7392 <at> gmail.com, 56425 <at> debbugs.gnu.org
Subject: Re: bug#56425: 28.1; post-command-hook is triggered on y-or-n-p
Date: Mon, 11 Jul 2022 14:39:31 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: Bhavin Gandhi <bhavin7392 <at> gmail.com>,  56425 <at> debbugs.gnu.org
> Date: Mon, 11 Jul 2022 12:54:26 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Why are you surprised?  y-or-n-p invokes read-from-minibuffer, which
> > invokes recursive-edit, which starts a recursive command loop.  And
> > the command loop calls post-command-hook on each iteration.
> 
> When writing post-command-hook code, you have to be check whether you're
> in the context you want to be (for instance, in the minubuffer or not).
> I think it's always been this way, but these day we use the
> read-from-minibuffer a lot more than we used to -- so y-or-n-p didn't
> use to have this issue, but it does now.

Yes.  Code that wants to distinguish these cases from "normal"
post-command-hook invocations should examine the value of
minibuffer-depth, I think.




This bug report was last modified 2 years and 314 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.