unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: 13641@debbugs.gnu.org
Subject: bug#13641: 24.3.50; `minibuffer-inactive-mode' - hook seems wrong
Date: Thu, 15 Jul 2021 08:49:38 +0200	[thread overview]
Message-ID: <87v95cm5q5.fsf@gnus.org> (raw)
In-Reply-To: <1FC09B5AA7D44DCDA241D3947B30BFA1@us.oracle.com> (Drew Adams's message of "Wed, 6 Feb 2013 15:04:53 -0800")

"Drew Adams" <drew.adams@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





  parent reply	other threads:[~2021-07-15  6:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-06 23:04 bug#13641: 24.3.50; `minibuffer-inactive-mode' - hook seems wrong Drew Adams
2013-02-06 23:55 ` Drew Adams
2013-03-07  2:59   ` Drew Adams
2021-07-15  6:49 ` Lars Ingebrigtsen [this message]
2021-07-15  7:21   ` Eli Zaretskii
2021-07-15  7:26     ` Lars Ingebrigtsen
2021-08-12 15:16   ` Lars Ingebrigtsen

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=87v95cm5q5.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=13641@debbugs.gnu.org \
    --cc=drew.adams@oracle.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).