GNU bug report logs - #48153
28.0.50; minor mode keymaps should not override keymap given to read-from-minibuffer

Previous Next

Package: emacs;

Reported by: Jimmy Yuen Ho Wong <wyuenho <at> gmail.com>

Date: Sun, 2 May 2021 07:01:01 UTC

Severity: normal

Tags: moreinfo

Found in version 28.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jimmy Yuen Ho Wong <wyuenho <at> gmail.com>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 48153 <at> debbugs.gnu.org
Subject: bug#48153: 28.0.50; minor mode keymaps should not override keymap given to read-from-minibuffer
Date: Wed, 5 May 2021 10:10:23 +0100
>
> Why would they not?  The minibuffer behaves, in that respect, like any
> other buffer.  Note that they do so only when the minor mode is enabled in
> the minibuffer.
>

Because the minibuffer does not behave like any other buffers. Setting
`minor-mode-overriding-map-alist` has no effect, so I think either the
minibuffer really needs to behave like any other buffer, or
special-cased and documented the ways it differs from regular buffers.

I have this code in my init.el, and it doesn't seem to work.

(defun ido-resurrect-keybinding ()
  (pcase-dolist (`(,minor-mode . ,keymap)
                 (seq-filter
                  (lambda (entry) (symbol-value (car entry)))
                  minor-mode-map-alist))
    (cl-loop for buf in (buffer-list)
             if (and (minibufferp buf)
                     (with-current-buffer buf
                       (symbol-value minor-mode)))
             do
             (map-keymap
              (lambda (event def)
                (when-let (key (and (or (characterp event)
                                        (and (symbolp event)
                                             (not (eq event 'remap))
                                             (not (keymapp def))))
                                    (if (characterp event)
                                        (format "%c" event)
                                      (vector event))))
                  (when (lookup-key ido-completion-map key)
                    (let ((map (copy-keymap keymap)))
                      (define-key map key nil)
                      (with-current-buffer buf
                        (push (cons minor-mode map)
                              minor-mode-overriding-map-alist))))))
              keymap))))

(with-eval-after-load 'ido
  (add-hook 'ido-setup-hook 'ido-resurrect-keybinding))




This bug report was last modified 4 years and 13 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.