[Top][All Lists]

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

Re: Proposal: Remap interactive commands via keymaps

From: Kim F. Storm
Subject: Re: Proposal: Remap interactive commands via keymaps
Date: 23 Jan 2002 01:32:30 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

Richard Stallman <address@hidden> writes:

>     >     (define-key x-mode-map [self-insert-command] 'x-self-insert-command)
>     How is this different from substitute-key-definition?  What am I
>     missing?
> You might be able to get the same jobs done with
> substitute-key-definition, but this is a lot more elegant--the code
> and the data structures would be simpler.  And this is more robust
> in its handling of subsequent rebinding of the other keymap.
> I think this is a great idea.

I've started adding this, and it is actually very simple.
Basically, I just need to call Fkey_binding at the right place
in command_loop_1.

However, at the place where I need to call Fkey_binding, the command
is a symbol, and Fkey_binding requires a vector.  So I need to wrap
the command argument using Fmake_vector before I call Fkey_binding.

I guess that is ok, but it would be more efficient not having to do
this, i.e. to be able to use the command symbol directly.

At the lowest level, this means that Flookup_key should accept a
symbol (i.e. a command) in addition to the current string and vector
arguments.  (The necessary changes to support this are trivial).

For consistency,define-key should also accept a symbol for the key

I think this makes sense at the user level too, as this is really a
mapping of one command into another, i.e.

  (define-key global-map 'self-insert-command 'x-self-insert-command)
  (lookup-key global-map 'self-insert-command)
  (key-binding 'self-insert-command)

would be the preferred method for remapping commands rather than 

  (define-key global-map [self-insert-command] 'x-self-insert-command)
  (lookup-key global-map [self-insert-command])
  (key-binding [self-insert-command])

Especially because things like
  (define-key global-map [self-insert-command ?x] 'x-self-insert-command)
don't make any sense...

What do you think?

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

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