Post ATRrtj4ihMz7JdEMJk by tennoseremel@lor.sh
(DIR) More posts by tennoseremel@lor.sh
(DIR) Post #ATR5dYC6ae7r8UuFOK by galdor@emacs.ch
2023-03-09T10:14:02Z
0 likes, 0 repeats
I wish there was a way in #Emacs to bind a global key in a way that cannot be overridden by any mode. It is extremely common to use global-set-key to bind something, only to see it replaced by another binding in the mode you are currently used.
(DIR) Post #ATR6n8o9vjXzFgqIr2 by frescosecco@mastodon.social
2023-03-09T10:26:58Z
0 likes, 0 repeats
@galdor it's Emacs, there *must* be a way to do this :)
(DIR) Post #ATR7NZg7VKNJ0vSHS4 by galdor@emacs.ch
2023-03-09T10:33:34Z
0 likes, 0 repeats
@mhd But then I would have to find a way to make sure this global minor mode is always loaded *after* all other minor modes to make sure any key bindings in its map will override any previous binding.
(DIR) Post #ATR7x6FiO1EmAz2neC by galdor@emacs.ch
2023-03-09T10:39:59Z
0 likes, 0 repeats
@mhd Thanks for the pointer, I'll see what I can do with this.
(DIR) Post #ATR8bUwW0XJ4KqKL0C by galdor@emacs.ch
2023-03-09T10:47:17Z
0 likes, 0 repeats
@mhd From what I understand I can just use bind-key* and be done with it.
(DIR) Post #ATR99LwlxbhYHTagJk by nthcdr@emacs.ch
2023-03-09T10:53:24Z
0 likes, 0 repeats
@galdor https://emacs.stackexchange.com/questions/352/how-to-override-major-mode-bindings
(DIR) Post #ATRWR5VS7gJPRvEn7A by fidel@mastodon.social
2023-03-09T15:14:19Z
0 likes, 0 repeats
@galdor There is a trick to have truly global keybindings in #emacs that won't be overshadowed: define a minor mode with a keymap and then assign your global keybindings to it.An example from my old personal configuration:https://github.com/haplo/prelude/blob/master/personal/preload/my-mode.elhttps://github.com/haplo/prelude/blob/master/personal/keybindings.el
(DIR) Post #ATRXD0RGGdH9dH7tYm by galdor@emacs.ch
2023-03-09T15:22:59Z
0 likes, 0 repeats
@fidel Yes, this is the advice I was given above. The trick is to put the keymap in emulation-mode-map-alists.
(DIR) Post #ATRrtj4ihMz7JdEMJk by tennoseremel@lor.sh
2023-03-09T19:14:48Z
0 likes, 0 repeats
@galdor Create your own minor mode and stuff stuff there. Appears to be working so far.
(DIR) Post #ATTEBxsEoBAoZiSDaK by galdor@emacs.ch
2023-03-10T10:59:20Z
0 likes, 0 repeats
@mhd I replaced all my workarounds by bind-key* and it works perfectly. Thank you for the tip!