unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* (define-key MAP [remap COMMAND] PREFIX-KEY-MAP)
@ 2019-09-27 21:20 Drew Adams
  2019-09-27 21:25 ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2019-09-27 21:20 UTC (permalink / raw)
  To: Emacs developers

(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?



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

end of thread, other threads:[~2019-09-28  3:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-27 21:20 (define-key MAP [remap COMMAND] PREFIX-KEY-MAP) Drew Adams
2019-09-27 21:25 ` Drew Adams
2019-09-28  3:59   ` Drew Adams

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