unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How do you know whether a keybinding already exists?
@ 2010-06-09 10:25 Elena
  2010-06-09 12:08 ` LanX
  0 siblings, 1 reply; 2+ messages in thread
From: Elena @ 2010-06-09 10:25 UTC (permalink / raw)
  To: help-gnu-emacs

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How do you know whether a keybinding already exists?
  2010-06-09 10:25 How do you know whether a keybinding already exists? Elena
@ 2010-06-09 12:08 ` LanX
  0 siblings, 0 replies; 2+ messages in thread
From: LanX @ 2010-06-09 12:08 UTC (permalink / raw)
  To: help-gnu-emacs

Hmm

C-h k and C-h c are bound to

`describe-key' and `describe-key-briefly'

did you try using this?


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-09 12:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-09 10:25 How do you know whether a keybinding already exists? Elena
2010-06-09 12:08 ` LanX

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).