Hi everyone, Thanks you all for the discussion and especially @Stefan for the patch. The patch looks good to me (I am on emacs 28 pgtk branch). It does cause lispy and telega to malfunction due to their use of minibuffer-inactive-mode, but I managed to fix those by replacing (eq major-mode 'minibuffer-inactive-mode) with (derived-mode-p 'minibuffer-mode). When this patch gets merged to master, I will send PRs to all the packages I am aware of using minibuffer-inactive-mode, i.e. lispy/telega/smartparens/lunarymacs (and possibly package-lint). Best regards, Sheng On Mon, Apr 19, 2021, at 13:22, Stefan Monnier wrote: > > 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 > > Sheng Yang(杨圣), PhD Computer Science Department University of Maryland, College Park E-mail: styang@fastmail.com E-mail (old but still used): yangsheng6810@gmail.com