From: Tomas Nordin <tomasn@posteo.net>
To: Emanuel Berg <moasenwood@zoho.eu>, help-gnu-emacs@gnu.org
Subject: Re: diff-goto-source hi-jacks my M-o
Date: Mon, 28 Dec 2020 17:41:38 +0100 [thread overview]
Message-ID: <87wnx16fy5.fsf@posteo.net> (raw)
In-Reply-To: <87y2hjjgxf.fsf@zoho.eu>
Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:
> Tomas Nordin wrote:
>
>>> No, it's not required there, you are free to enable
>>> ‘my-precious-keys-map’ unconditionally as well:
>>>
>>> (add-to-list 'emulation-mode-map-alists
>>> (list (cons t my-precious-keys-map)))
>>>
>>> if you feel that you will never need to suspend it.
>>
>> Alright, then we know the way to go if we have a set of
>> bindings that must never be "hi-jacked"
>>
>>>> And that the trickery with the key-maps is hard to follow
>>>> for me.
>>>
>>> There is no any trickery, just a hardcoded priority order
>>> in Emacs itself: global map is overridden by major mode
>>> map, which in turn is overridden by minor mode maps, which
>>> can be overridden by emulation mode maps.
>>>
>>> That is, using a minor mode map would suffice in your
>>> specific case — about M-o in diff-mode. But so would
>>> a mere:
>>>
>>> (with-eval-after-load 'diff-mode
>>> (define-key diff-mode-map
>>> (kbd "M-o") nil)) ; also on RET, o, C-c C-c, which is more than enough
>>
>> That's the way I go about it. It is rare enough this binding
>> is used anywhere (apart from the original binding about
>> setting face of course)
>
> Don't know what this discussion is about but I use M-o all the
> time! It is so comfortable, and requires minimal finger
Indispensable!
> movement from "asdf/jkl;" - I have it "other-window-or-split" [1]
> which is like pretty much the foundation of my ways with windows, not
> unlike a bunch of Isaac Asimov novels I keep under one table leg, to
> prevent it from wobbling...
>
> The way I solved it with M-o (this was ages ago, I set this
> up) I put that and other untouchable keys in
> "super-global-keys" and then for every mode that dares
> infringe, which is evident instantly, I call
> "disable-super-global-keys"
>
> (defun disable-super-global-keys (&optional map)
> "Disable the super global keys so they can be assigned.
> Use the current map unless MAP is provided."
> (dolist (k super-global-keys)
> (define-key (or map (current-local-map)) k nil) )) ; [2]
>
> In all my Emacs I have called it 22 times, so maybe that is an
> approximation of the number of modes that had to be told "step
> back son, there is nothing to see".
See the suggestion from Dmitry upthread, it was a way to let a binding
be available always as I understand, by one code block using
`emulation-mode-map-alists'.
I wonder what all those 22 situations are where you need to nil the
binding out. So far it happened only in diff-mode for me. I set my
precious binding like this
(global-set-key (kbd "M-o") 'other-window)
but diff-mode took it.
Ahh, but now I understand. You have all sorts of bindings you enforce
around Emacs? The suggestion upthread seem to be good for that.
>
> No idea if this solution is even close to canonical, probably
> not, but it seems bulletproof enough, so I thought I'd tell
> you about it.
Thanks
--
Tomas
prev parent reply other threads:[~2020-12-28 16:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-05 15:55 diff-goto-source hi-jacks my M-o Tomas Nordin
2020-07-05 20:39 ` Tomas Nordin
2020-07-06 2:20 ` Dmitry Alexandrov
2020-07-06 10:27 ` Tomas Nordin
2020-07-06 19:37 ` Dmitry Alexandrov
2020-07-06 20:07 ` Tomas Nordin
2020-07-06 21:46 ` Dmitry Alexandrov
2020-12-27 15:09 ` Tomas Nordin
2020-12-27 17:29 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-28 16:41 ` Tomas Nordin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wnx16fy5.fsf@posteo.net \
--to=tomasn@posteo.net \
--cc=help-gnu-emacs@gnu.org \
--cc=moasenwood@zoho.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).