unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#2179: 23.0.60; define-key vs define-key-after key syntax
@ 2009-02-03  7:31 Gerard Brunick
  2011-09-11 21:18 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Gerard Brunick @ 2009-02-03  7:31 UTC (permalink / raw)
  To: emacs-pretest-bug

This may or may not be a bug, but it caused me some pain, so I am 
pointing it out.

(define-key my-map [(control l)] 'do-something)

works as expected, but

(define-key-after my-map [(control l)] 'do-something)

does not.  The reason is that define-key does a lot of work to allow
for a wide range of key syntaxes, but define-key-after just does:

(setq key
      (if (<= (length key) 1) (aref key 0) ...

and (control l) must get mapped to ?\C-l = 12 to be useful in a keymap.
As I say, I'm not sure this is a bug, but it was rather
counter-intuitive to me, so maybe a warning to this effect in the
documentation for define-key-after would be sufficient.  The current
documentation says "... This is like `define-key' except that the binding
for KEY is placed just after the binding for the event AFTER ..."

Cheers,
Gerard






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

end of thread, other threads:[~2011-10-06 19:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-03  7:31 bug#2179: 23.0.60; define-key vs define-key-after key syntax Gerard Brunick
2011-09-11 21:18 ` Lars Magne Ingebrigtsen
2011-09-11 21:48   ` Andreas Schwab
2011-09-11 22:22     ` Lars Magne Ingebrigtsen
2011-09-12  7:48       ` Andreas Schwab
2011-09-12  7:59         ` Lars Magne Ingebrigtsen
2011-09-12  8:14           ` Andreas Schwab
2011-10-05  5:08           ` Glenn Morris
2011-10-06 19:16             ` Lars Magne Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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