[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#2179: 23.0.60; define-key vs define-key-after key syntax

From: Gerard Brunick
Subject: bug#2179: 23.0.60; define-key vs define-key-after key syntax
Date: Tue, 03 Feb 2009 01:31:34 -0600
User-agent: Thunderbird (X11/20090105)

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]