From: Tassilo Horn <tsdh@gnu.org>
To: Nicolas Richard <theonewiththeevillook@yahoo.fr>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: Stop modes from hijacking several global keys
Date: Wed, 05 Nov 2014 12:38:56 +0100 [thread overview]
Message-ID: <87a94598rz.fsf@thinkpad-t440p.tsdh.org> (raw)
In-Reply-To: <87lhnqougl.fsf@yahoo.fr> (Nicolas Richard's message of "Wed, 05 Nov 2014 10:41:30 +0100")
Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:
Hi Nicolas,
>>> Ideally, that magic would stop the mode from hijacking M-<number>
>>> keys, and whatever it wants to bind to M-<number> would
>>> automagically be bound to `<escape> M-<number>' instead.
>>>
>>> I think at least for major-modes I can use
>>> `after-change-major-mode-hook' in combination with a function
>>> checking (key-binding (kbd "M-<number>")) and doing `local-set-key'
>>> if needed.
>
> Since minor modes have precedence of major modes, you could define
> your own minor mode with those keybindings.
I don't think that would make a difference. Note that I want the
commands that a (major-) mode would bind to `M-<number>' to be still
available via `<escape> M-<number>', so I'd need to do what
`th/select-nth-window-ensure-keys' from my previous mail does whenever
my mode is activated. (And for it to be a proper minor-mode, it should
undo that when it gets deactivated.)
Looking at `define-globalized-minor-mode' that basically does the same
what I did: put a function in `after-change-major-mode-hook' that
enables the minor-mode. I've put a function there that reclaims my
keys.
And then the problem of a minor-mode that gets activated after my own
minor-mode and then again steals my keys isn't solved, too. For that,
I'd somehow need to ensure that my own minor-mode (or currently my
gimme-back-my-keys function) is and always stays the last function run
by `after-change-major-mode-hook'.
Anyway, this is now a more or less theoretical discussion because until
now it have always been major modes stealing my keys. And by
convention, a minor-mode shouldn't bind M-<number> anyway.
Bye,
Tassilo
prev parent reply other threads:[~2014-11-05 11:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-05 7:02 Stop modes from hijacking several global keys Tassilo Horn
2014-11-05 7:12 ` Tassilo Horn
2014-11-05 9:41 ` Nicolas Richard
2014-11-05 11:38 ` Tassilo Horn [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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a94598rz.fsf@thinkpad-t440p.tsdh.org \
--to=tsdh@gnu.org \
--cc=help-gnu-emacs@gnu.org \
--cc=theonewiththeevillook@yahoo.fr \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.