GNU bug report logs - #47150
28.0.50; Incorrect major-mode in minibuffer

Previous Next

Package: emacs;

Reported by: styang <at> fastmail.com

Date: Mon, 15 Mar 2021 00:58:01 UTC

Severity: normal

Found in version 28.0.50

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Alan Mackenzie <acm <at> muc.de>
Cc: "47150 <at> debbugs.gnu.org" <47150 <at> debbugs.gnu.org>,
 Sheng Yang <styang <at> fastmail.com>, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: [External] : bug#47150: 28.0.50; Incorrect major-mode in
 minibuffer
Date: Mon, 19 Apr 2021 14:22:23 -0400
> diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi
> index 1eba7074f7..6f2935f1f6 100644
> --- a/doc/emacs/mini.texi
> +++ b/doc/emacs/mini.texi
> @@ -247,6 +247,9 @@ Minibuffer Edit
>  to show the current recursion depth in the minibuffer prompt
>  on recursive use of the minibuffer.
>  
> +  When active, the minibuffer is in @code{minibuffer-mode}.  This is
> +an internal Emacs mode without any features for the user.

I don't think we should be so definitive about it (I don't think we
should consider it a bug if some package decides to change the major
mode to something else from `minibuffer-setup-hook`, for instance).

So, I'd either not document it at all, or add something like "usually"
in there to tone things down.

> +@cindex active minibuffer
> +  An active minibuffer has major mode @code{minibuffer-mode}.  This is
> +an Emacs internal mode, and there is never any point in calling it or
> +otherwise trying to manipulate it.

I don't see the point in trying to discourage people from using it:
I don't see any reason to expect uses to be harmful, nor do I see any
sign that hordes are just waiting to jump on the opportunity to (ab)use
this mode in unexpected ways.

> Rather than using
> +@code{minibuffer-mode-hook}, you should use
> +@code{minibuffer-setup-hook} (@pxref{Minibuffer Misc}).

Sounds fine.  We may even motivate it by explaining that at the time
`minibuffer-mode-hook` is run the (mini)buffer is not yet fully prepared
(e.g. the keymap is not yet set).

> +(define-derived-mode minibuffer-mode nil "Minibuffer"
> +  "Major mode used only in active minibuffers.
> +This mode is used internally, and should not be set by user code
> +in any way, although it may be tested by such code.  Use
> +`minibuffer-setup-hook' and `minibuffer-exit-hook' rather than
> +the mode hook of this mode."

Same here, I don't see the need to waste time discouraging people to set
it themselves.

Other than those nitpicks: LGTM, thank you,


        Stefan





This bug report was last modified 4 years and 33 days ago.

Previous Next


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