Re: Manipulating keymaps
Eli Zaretskii <[email protected]> Mon, 15 Jun 2026 14:56:22 +0300
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <[email protected]> |
> From: Dr Rainer Woitok <[email protected]> > Date: Mon, 15 Jun 2026 10:16:16 +0200 > Cc: [email protected] > > Elin, > > On Sunday, 2026-06-14 17:22:24 +0300, you wrote: > > > ... > > Key bindings in the global keymap were _always_ overridden by local > > bindings. That's how major and minor modes define key bindings that > > override the global ones. > > Ok, so perhaps I was just lucky and used less major and minor modes or > these modes had less key bindings defined. Example: In all modes I used > with Emacs 28.2 key "M-q" just ran function "fill-region". Emacs 30.2 > uses the same key binding in "Fundamental" mode, but as soon as I open a > Shell, Perl or Python script or an "*.el" file, key "M-q" is bound to > "prog-fill-reindent-defun" which simply doesn't do exactly what I want > or at least what I'm used to. > > So I would like to at least change this key binding in the modes associ- > ated with these file types, but ideally in all modes. Is there an easy > way to achieve this? In your init file, define mode hooks, one each for every one of the modes where you want to change these bindings, and have the mode hook do the rebinding as you see fit.