unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Gerard Brunick <gbrunick@math.utexas.edu>
To: emacs-pretest-bug@gnu.org
Subject: bug#2179: 23.0.60; define-key vs define-key-after key syntax
Date: Tue, 03 Feb 2009 01:31:34 -0600	[thread overview]
Message-ID: <4987F2D6.2010900@math.utexas.edu> (raw)

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






             reply	other threads:[~2009-02-03  7:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-03  7:31 Gerard Brunick [this message]
2011-09-11 21:18 ` bug#2179: 23.0.60; define-key vs define-key-after key syntax 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

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4987F2D6.2010900@math.utexas.edu \
    --to=gbrunick@math.utexas.edu \
    --cc=2179@emacsbugs.donarmstrong.com \
    --cc=emacs-pretest-bug@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 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).