From: Drew Adams <drew.adams@oracle.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: (define-key MAP [remap COMMAND] PREFIX-KEY-MAP)
Date: Fri, 27 Sep 2019 14:20:13 -0700 (PDT) [thread overview]
Message-ID: <50d90eb8-10e2-4151-a1db-2eb66c5f92ff@default> (raw)
(defvar my-map nil "...")
(define-prefix-command 'my-map)
(define-key my-map (kbd "a") 'forward-char)
(define-key my-map (kbd "b") 'backward-char)
This is OK:
(define-key global-map (kbd "C-n") 'my-map)
These are not OK:
1. (define-key global-map [remap next-line] my-map)
2. (define-key global-map [remap next-line] 'my-map)
Using `C-n' (normally bound to `next-line') raises an
error saying that the keymap (for #1) or the keymap
variable (for #2) is not a command (`commandp').
Apparently the handling of pseudo function-key `remap'
doesn't cover this case. Shouldn't it be able to?
Same thing if you use, say, one of these instead of
`define-prefix-command':
(fset 'my-map my-map)
(fset 'my-map 'my-map)
Apparently the problem isn't the definition of the
keymap for the prefix key. And it isn't because
`define-key' can't handle a `symbol-function' value
that's a keymap or a symbol whose `symbol-value' is
a keymap (it can).
The problem seems to be only with the way the
[remap COMMAND] is handled by `define-key' (and by
`global-set-key' etc.).
Is it feasible to have this case handled too?
next reply other threads:[~2019-09-27 21:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-27 21:20 Drew Adams [this message]
2019-09-27 21:25 ` (define-key MAP [remap COMMAND] PREFIX-KEY-MAP) Drew Adams
2019-09-28 3:59 ` Drew Adams
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=50d90eb8-10e2-4151-a1db-2eb66c5f92ff@default \
--to=drew.adams@oracle.com \
--cc=emacs-devel@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.