bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Stefan Monnier
Subject: bug#47150: [External] : bug#47150: 28.0.50; Incorrect major-mode in minibuffer
Date: Mon, 19 Apr 2021 14:22:23 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> 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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]