Hey there,
I'm trying to set certain keybindings to be global but I don't want
_any_ major or minor mode to be able to change them. One example:
M-o should always be 'other-window
I'd start with (global-set-key (kbd "M-o") 'other-window) and that
works, until there is a major mode that sets it locally.
Example: rcirc overwrites M-o.
I tried several things to get rid of them without specifically setting
rcirc-map locally to nil, because I have several and I just want a
general solution.
What I tried:
(add-hook 'after-change-major-mode-hook
'(lambda () (define-key (current-local-map) (kbd "M-o")
'nil)))
This doesn't work. M-o still does rcirc omit mode.
Apparently that's not the very latest hook that is run after a buffer
is initialized. Maybe there is a hook that gets called after every
(use-local-map) or so?
Another hack would be to get a list of all -maps at any given moment and
map through it and run a (define-key mapcmap ...)
Any idea if there is a variable that holds them all?
Two other ways that people on #emacs suggested are creating a minor mode
as some sort of overlay and/or somehow use overriding-local-map.
I haven't investigated the minor mode one, but the overriding-local-map
is neither a function nor a variable if you ask define-key... (both are
void, but documented)
Does anyone have an idea how to fix this or has any other pointers, I
would be very happy.