bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#48153: 28.0.50; minor mode keymaps should not override keymap given


From: Jimmy Yuen Ho Wong
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))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]