Re: Manipulating keymaps

Perry Smith <[email protected]> Mon, 15 Jun 2026 15:23:32 -0500
Newsgroups gmane.emacs.help
Message-ID <[email protected]>

> On Jun 15, 2026, at 03:16, Dr Rainer Woitok <[email protected]> wrote:
> 
> 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?

Long long ago, I wanted my own private key map and discovered, at the time, that C-\ was not used.  So I put my keymap there and add keys to it over time.
At this point, the default is to bind it to toggle-input-method which I override:

https://github.com/pedz/emacs/blob/master/pedz/pedz.org#personal-keymap