From: Elena <egarrulo@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: How do you know whether a keybinding already exists?
Date: Wed, 9 Jun 2010 03:25:31 -0700 (PDT) [thread overview]
Message-ID: <61b16d04-f678-49cb-98f3-e678dbd13fe8@x21g2000yqa.googlegroups.com> (raw)
Hello,
I'd like to trace whenever a key-binding is being overwritten, and
eventually forbidding some overwrites.
My understanding is that both "global-set-key" and "local-set-key"
rely on "define-key", therefore I've written this advice:
(defadvice define-key (around protect-bindings
(keymap key def)
activate) ;; I'm using an "around"
advice to eventually disable the overwrite.
(when (key-binding-exists key keymap) ;; For "key-binding-exists",
read on.
(message "Overwriting %S binding." key))
ad-do-it)
I don't know how to write the "key-binding-exists" function.
Or it would be better to follow a different route altogether?
Thanks.
next reply other threads:[~2010-06-09 10:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-09 10:25 Elena [this message]
2010-06-09 12:08 ` How do you know whether a keybinding already exists? LanX
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=61b16d04-f678-49cb-98f3-e678dbd13fe8@x21g2000yqa.googlegroups.com \
--to=egarrulo@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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.