unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Gregory Heytings <gregory@heytings.org>, 48153@debbugs.gnu.org
Subject: bug#48153: 28.0.50; minor mode keymaps should not override keymap given to read-from-minibuffer
Date: Thu, 6 May 2021 11:55:25 +0100	[thread overview]
Message-ID: <CAKDRQS5kWZhxe-TMD6irJzUQYQOHs1RT=yQV2=VCrDpF3K-3+w@mail.gmail.com> (raw)
In-Reply-To: <jwvr1ili890.fsf-monnier+emacs@gnu.org>

Ok I think I've found a solution to my problem. There are a couple of
things that I didn't understand and had to attach a function to print
out which one is being called on 5 different hooks to find out the
invocation order.

This is call order I've found:

1. ido-setup-hook
2. minibuffer-mode-hook
3. minibuffer-setup-hook
4. minibuffer-exit-hook
5. minibuffer-inactive-mode-hook

Specifically, the override keymaps are cleared between step 1 and 2,
so if I loop thru the minibuffers in step 1 to assign to
minor-mode-override-map-alist inside them, they will be reset in step
2 I suppose. So if I needed to "unshadow" the shadowed keybindings
inside the minibuffer, I had to do these processing in
minibuffer-setup-hook because that is called every time the minibuffer
is entered.

Thanks for your help, you can close this issue now.

Jimmy

On Wed, May 5, 2021 at 3:18 PM Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
> > 1. On emacs 27, minor mode keybindings will only override the key
> > bindings given to read-from-minibuffer after the second invocation of
> > the minibuffer, but doesn't on the first invocation.
>
> Something like that, yes.
> That's only for minor modes defined via `define-globalized-minor-mode`.
> Not for global minor modes defined in the usual way via (define-minor-mode
> ... :global t ...).
>
> This change makes for a more predictable behavior and is a side-effect
> of the change described in etc/NEWS as:
>
>     ** An active minibuffer now has major mode 'minibuffer-mode', not the
>     erroneous 'minibuffer-inactive-mode' it formerly had.
>
> More specifically, the difference is that in Emacs<28 sometimes those
> globalized minor modes where not enabled (hence their keybindings are
> not active).
>
> > 2. On emacs 28, minor mode keybindings override the key bindings given
> > to read-from-minibuffer at all times.
>
> And this was also true in all previous versions of Emacs.
>
> > 3. But, `minor-mode-overriding-map-alist` does not override the
> > override in effect in the minibuffer like other buffers.
>
> That's the part of your bug report I haven't understood yet.
>
> > My expectation is when a keymap is explicitly given to
> > read-from-minibuffer, the key bindings in it should take precedence,
> > but it doesn't.
>
> No, this keymap is the "local map" a.k.a "major mode map", so it has
> lower precedence than minor keymaps.  Always had.
>
> > As you can see from the snippet from my last email, both
> > ido-completion-map and test-mode bind to C-k, I expect the C-k binding
> > in ido-completion-map to take effect inside the minibuffer, without
> > being overridden by any minor modes in effect inside the minibuffer.
>
> This expectation is incorrect ;-)
>
> > If this is not to be desired, I'd expect setting
> > minor-mode-overriding-map-alist or the usual key binding lookup search
> > algorithm to work inside the minibuffer.
>
> This should be the case: minibuffers are treated exactly like all other
> buffers by the keymap code, AFAIK.
>
>
>         Stefan
>





  reply	other threads:[~2021-05-06 10:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-02  6:58 bug#48153: 28.0.50; minor mode keymaps should not override keymap given to read-from-minibuffer Jimmy Yuen Ho Wong
2021-05-03 15:15 ` Gregory Heytings
2021-05-04 12:53   ` Jimmy Yuen Ho Wong
2021-05-04 13:13     ` Gregory Heytings
2021-05-04 13:52       ` Jimmy Yuen Ho Wong
2021-05-04 14:02         ` Gregory Heytings
2021-05-04 14:29           ` Gregory Heytings
2021-05-04 16:15             ` Jimmy Yuen Ho Wong
2021-05-04 16:36               ` Gregory Heytings
2021-05-04 22:40                 ` Jimmy Yuen Ho Wong
2021-05-05  8:09                   ` Gregory Heytings
2021-05-05  9:10                     ` Jimmy Yuen Ho Wong
2021-05-05 12:15                       ` Eli Zaretskii
2021-05-05 13:12                         ` Gregory Heytings
2021-05-05 13:24                           ` Jimmy Yuen Ho Wong
2021-05-05 14:17                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-06 10:55                               ` Jimmy Yuen Ho Wong [this message]
2021-05-09 14:57                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-05 13:06                       ` Gregory Heytings
2021-05-05 14:05     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKDRQS5kWZhxe-TMD6irJzUQYQOHs1RT=yQV2=VCrDpF3K-3+w@mail.gmail.com' \
    --to=wyuenho@gmail.com \
    --cc=48153@debbugs.gnu.org \
    --cc=gregory@heytings.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).