Subject: bug#47150: [External] : bug#47150: 28.0.50; Incorrect major-mode in minibuffer

From: Alan Mackenzie <[email-masked]>
Date: Mon, 12 Apr 2021 18:34:34 +0000

Hello, Stefan.

On Mon, Apr 12, 2021 at 13:10:57 -0400, Stefan Monnier wrote:
> > Why?  Until very recently (? 2 months ago), minibuffer-inactive-mode
> > served for both active and inactive MBs.

> No: it was *activated* every time the minibuffer became inactive (and
> not when the minibuffer was becoming active), and its keymap was only
> active when the minibuffer was inactive.

OK, what you say is true, what I said above is also true - active
minibuffers ran in minibuffer-inactive-mode (apart from the first
invocation of a MB), getting their key maps from the calling Lisp
commands.  At the end of the MB action m-inactive-m was called.

> The keymap and the hook are the main two features of
> `minibuffer-inactive-mode`.

Yes.  Possibly they're the only features.

Am I right in thinking that your main worry is the hook not getting
called at the end of every MB action?

> > The idea here is to avoid the proliferation of unneeded major modes.

> Major modes are cheap.  There is no problem with proliferation.

That's not true - the OP has found a problem, in that some minor modes
switch themselves on when (memq major-mode foo-mode-list).  The current
situation, fundamental-mode (active), minibuffer-inactive-mode
(inactive) is causing problems with that scheme, hence this bug.

> > We don't seem to need two distinct modes here for the minibuffer.

> The two situations are very different, where the users expect very
> different behavior.

They are indeed very different, but that difference is entirely
accounted for by the key map (and optionally, the mode hook).

> > This is pretty much, but not quite, the same as how things were up until
> > recently.

> No, it's completely different: the difference may seem minor, but
> this minor reason is the raison d'être of `minibuffer-inactive-mode`, so
> what you're suggesting is, in practice, the removal of
> `minibuffer-inactive-mode`.

I don't think that's right.  What I'm proposing is renaming it (with
temporary alias), and regularising what used to be an ugly situation.

How about having just minibuffer-mode, and calling it at the end of
every MB action (as was previously done with minibuffer-inactive-mode),
but not at the start of a MB action?  This will call the mode hook at
the same times as the m-inactive-m-hook used to be called, and reset the
MB's keymap to the inactive map at the same time.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).