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

From: Jimmy Yuen Ho Wong <[email-masked]>
Date: Tue, 4 May 2021 23:40:41 +0100

Sorry I'm really bad at giving instructions. Here's some additional information.

First of all, this is the entirety of the test init.el.

(defun bad ()
  (interactive)
  (message "BAD !"))

(define-minor-mode test-mode ""
  :keymap
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "C-k") 'bad)
    map))

(define-global-minor-mode test-global-mode test-mode (lambda () (test-mode 1)))

(test-global-mode 1)
(ido-mode 1)
(setf enable-recursive-minibuffers 1)

Once emacs has started, C-x b C-h b should show that C-k is bound to `bad`.

Second of all, in order to get the key map bindings to
read-from-minibuffer overridden on emacs 27, it requires quitting from
switch-to-buffer, and then C-x b C-h b again to see that C-k is bound
to `bad`. In other words, on emacs 27, one has to pop up the
minibuffer twice. On emacs 28, just opening the minibuffer the first
time will see the key bindings overridden. I guess this is why I say
this is a regression on emacs 28 but you said you couldn't reproduce
it. I think both versions are wrong, it's just on emacs 28, it's wrong
in a more obvious way. In any case, I'm not sure if the minor mode
maps should override the key bindings in the keymap given to
read-from-buffer.

Jimmy

On Tue, May 4, 2021 at 5:36 PM Gregory Heytings <[email-masked]> wrote:
>
>
> >
> > The minor mode is exactly the same as what you have in your previous
> > email. What actually happens in my regular setup is the key bindings in
> > multiple minor modes override the key map given to read-from-minibuffer.
> > The problem is I don't want to turn off those minor mode as they used to
> > work in the minibuffer in emacs 27 as intended, but not so in emacs 28.
> >
>
> The problem is that, with the test-mode in my previous mail, I cannot
> reproduce the issue.
>
> >
> > One mode is smartparens and another is move-dup.
> >
>
> But neither of these minor modes override C-k, which you mentioned in your
> original bug report?
>
> I tried move-dup, and its four bindings do not override the corresponding
> bindings in the minibuffer, with or without ido-mode.
>
> So I still cannot see the issue you see...