Buffer-locally overriding minor-mode key bindings in Emacs
emacs
Solution
It's a bit cumbersome to do. You can do something like:
(add-hook '<major-mode>-hook
(lambda ()
(let ((oldmap (cdr (assoc '<minor-mode> minor-mode-map-alist)))
(newmap (make-sparse-keymap)))
(set-keymap-parent newmap oldmap)
(define-key newmap [<thekeyIwanttohide>] nil)
(make-local-variable 'minor-mode-overriding-map-alist)
(push `(<minor-mode> . ,newmap) minor-mode-overriding-map-alist))))
Problem
I want to use a minor mode which rebinds a major-mode key that I definitely want to keep. How can I rebind the key without deleting it from the minor-mode map globally? I know I can use `define-key` for that, but I would like to keep the binding for other buffers/major modes. Can anyone help?