emacs-devel
[Top][All Lists]
Advanced

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

Re: local keymap patch for key-binding


From: David Kastrup
Subject: Re: local keymap patch for key-binding
Date: Tue, 12 Sep 2006 12:04:01 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Richard Stallman <address@hidden> writes:

>      (`key-binding' can't be used to look up events, and I am less
>     than certain that it should).
>
> Of course key-binding can be used to look up events.  If you want to
> look them up in the current active keymaps, key-binding is the
> natural way.

I think we are talking about different things here.  Call
M-: (eventp (read-key-sequence nil)) RET
and click with the mouse somewhere.  You will get "nil" as a result
since read-key-sequence does not return an event, but rather an array
with the 0th element being an event.

key-binding in its current code by Chong can only deal with such an
event _sequence_ (which is not an event according to eventp).

If you thing it reasonable that key-binding should also react to
bona-fide events _not_ wrapped in an array, I can do this easily
enough in the change I am working on.

> The recent change affects the lookup of events that specify
> positions.  It has no effect on what happens if you pass a list of
> event-types without positions.
>
> Perhaps there is a misunderstanding here about what it means
> to "look up events".
>
>     a) add an additional optional parameter BASE-KEY which, when non-NIL,
>     will replace KEY for all purposes of lookup except determining the
>     keymaps to use when KEY is a key-sequence based on an event.
>
> I don't follow this at all, sorry.

We have the situation that we want to look up an artificial
"follow-link" keymap entry depending on the keymaps where a click was
made.  It would be nice to do this with

(key-binding click-event nil nil 'follow-link)

>     b) have a function `event-replace-key' or something with a
>     better name which will take a key sequence based on an event and
>     swap out the basic event (but maybe _not_ its modifiers since
>     they can play a part in which keymap to use) and swap out the
>     `down-mouse-2' or similar with `follow-link'.
>
> What does "swap out" mean here?

Replace it (actually, make a copy and replace the `down-mouse-1'
symbol in the copy with `follow-link').


-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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