Subject: bug#48153: 28.0.50; minor mode keymaps should not override keymap given to read-from-minibuffer

From: Gregory Heytings <[email-masked]>
Date: Mon, 03 May 2021 15:15:25 +0000

>
> After typing C-x b or C-x C-f, the minor mode maps from the buffer that 
> launched the minibuffer will override the keymap given to 
> `read-from-minibuffer`, this seems to be a regression in emacs 28 
> master.
>
> Reproduction:
>
> 1. Turn on `ido-mode`
> 2. Turn on some minor mode that rebinds `C-k` with `(define-key
> some-minor-mode-map (kbd "C-k") 'some-func)`
> 3. C-x b
> 4. Select a buffer and type C-k
>
> Expectation:
>
> C-k should be bound to `ido-kill-buffer-at-head` and calls it, but 
> instead `some-func` is called.
>
> Since C-k is bound in `ido-completion-map`, and it is given to 
> `read-from-minibuffer`, all the bindings in `ido-completion-map` should 
> take precedence.
>

Thanks for your bug report.  I'm unable to reproduce your recipe on recent 
versions of the trunk (today, a week ago).  I tried

(define-minor-mode test-mode "" :keymap (let ((map (make-sparse-keymap))) (define-key map (kbd "C-k") '(lambda () (interactive) (message "BAD !"))) map))

and C-k is indeed bound to 'ido-kill-buffer-at-head'.  I suspect this 
misbehavior is due to your configuration; if not, could you try to create 
a recipe starting with emacs -Q?