GNU bug report logs - #13641
24.3.50; `minibuffer-inactive-mode' - hook seems wrong

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Wed, 6 Feb 2013 23:07:02 UTC

Severity: minor

Tags: moreinfo

Found in version 24.3.50

Fixed in version 28.1

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 13641 <at> debbugs.gnu.org
Subject: bug#13641: 24.3.50; `minibuffer-inactive-mode' - hook seems wrong
Date: Thu, 15 Jul 2021 08:49:38 +0200
"Drew Adams" <drew.adams <at> oracle.com> writes:

> I don't have the C sources, so cannot see just how/when
> the hook `minibuffer-inactive-mode-hook' gets called.

It seems that it's called twice.  To test:

(add-hook 'minibuffer-inactive-mode-hook 'debug)
M-x

Debugger entered: nil
  (closure (t) nil (debug) (message "foo"))()
  run-hooks(change-major-mode-after-body-hook minibuffer-inactive-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook minibuffer-inactive-mode-hook))
  run-mode-hooks(minibuffer-inactive-mode-hook)
  minibuffer-inactive-mode()
  read-from-minibuffer("M-x " nil (keymap (10 . minibuffer-complete-and-exit) (
  completing-read-default("M-x " #f(compiled-function (string pred action) #<by
  completing-read("M-x " #f(compiled-function (string pred action) #<bytecode -
  read-extended-command()

The mode is called both on entering and exiting the minibuffer, which
sounds slightly surprising (but it doesn't really say anything about
when it's invoked, either).  I guess it's this:

  /* In case the previous minibuffer displayed in this miniwindow is
     dead, we may keep displaying this buffer (tho it's inactive), so reset it,
     to make sure we don't leave around bindings and stuff which only
     made sense during the read_minibuf invocation.  */
  call0 (Qminibuffer_inactive_mode);

Perhaps the doc string of `minibuffer-inactive-mode' should mention that
it may be called several times, and that people looking at the mode's
hook should probably be looking at minibuffer-exit-hook instead?  Any
opinions?

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




This bug report was last modified 3 years and 288 days ago.

Previous Next


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