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

From: Alan Mackenzie <[email-masked]>
Date: Mon, 22 Mar 2021 16:27:30 +0000

Hello, Drew.

On Mon, Mar 22, 2021 at 15:52:13 +0000, Drew Adams wrote:
> Hi Alan.

> Sorry, I can't speak authoritatively or specifically about this.

> But I fear this will break things - just what, I don't know.  I use
> minibuffers a lot, in various ways.

Things are already broken, slightly.

> I fear that because perhaps no one will be able to offer a concrete
> reason why you shouldn't make such a change, you'll make it, and only
> (much?) later will we find out that it's broken stuff.  And then we'll
> hear once again that "That ship has sailed."

In my recent enhancements to the minibuffer handling, I noticed that
minibuffers (the actual buffers) began life in fundamental-mode, got
used, then on termination were put into minibuffer-inactive-mode.

However, on being reused, these buffers remained in
minibuffer-inactive-mode rather than being restored to fundamental-mode.
This is silly, and "obviously" a bug.  I fixed this bug by making an
active minibuffer always be in fundamental-mode.

> The minibuffer should be available by default for general editing.  It
> has its own keymaps, etc.  It may not matter what major mode it's in by
> default - that's my guess, in fact - but then again, it may.  And if it
> doesn't matter, then why change things?

An active minibuffer doesn't use its own key map - it uses the key map
supplied to it by the calling function.  This is how being in
minibuffer-inactive-mode (which does have its own key map) "worked" for
so long.

> Why do you find a need now to give it a special/new major mode?  What's
> the real problem you're trying to solve?  Or is this just another case
> of looking at the C code and thinking that something isn't "consistent"
> or "complete" enough?

The OP of this bug tells me that minor modes which maintain lists of
"valid" major modes they work in, included minibuffers by including
minibuffer-inactive-mode in their lists.  This sort of worked (except for
the first time a minibuffer was used), but is undesirable.

So the idea is to allow these minor modes to specify minibuffer-mode.

> Is there a real bug that you're trying to solve here?  If so, what's a
> simple recipe to repro it?

I think there's a bug here, yes.  I don't know of any particular minor
mode, off hand, that is affected by this, but the OP assure me they
exist.  This isn't really the sort of bug that has recipes.

> Apologies for being skeptical.  Likely this will be of no consequence
> (but then why do it?).  But maybe not?

No apology needed!  Thanks for raising the points.

-- 
Alan Mackenzie (Nuremberg, Germany).