emacs-devel
[Top][All Lists]
Advanced

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

Re: A simple implementation of context-sensitive keys


From: Lennart Borgman (gmail)
Subject: Re: A simple implementation of context-sensitive keys
Date: Sat, 13 Sep 2008 01:46:29 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

Tassilo Horn wrote:
> "Lennart Borgman" <address@hidden> writes:
> 
> Hi Lennart,
> 
>>> Sorry, no time to write the code now.  What I mean is that in
>>>
>>>  (info "(elisp)Searching Keymaps")
>>>
>>> there's the pseudocode how emacs finds the command for a key.  Now
>>> you can surrogate "FIND-IN" with lookup-key and see if the key is
>>> bound in the map.  In that code you know the map or at least the
>>> mode, cause you either have the variable directly (like
>>> overriding-local-map) or you walk an alist of the form ((mode-name
>>> . keymap)...) in the case of FIND-IN-ANY.
>> It would be good if that where true, but it is not. You have to take a
>> closer look to understand how this works. I think a good start might
>> be the code I sent before.
> 
> Here's a q&d implementation of what I thought should do the trick.  It
> works for me, although only very briefly tested.
> 
> --8<---------------cut here---------------start------------->8---
> (defun find-key-commands (key)
>   (let (list)
>     (when overriding-terminal-local-map


Yes, the structure of the key binding search must be mirrored in the
routine. But the problem I tried to solve was rather to find the keymap
variable names.

You do not have those names available anywhere really. You have to guess.

But combining the mirrored structure with the routine that guesses the
keymap variable name would be the best I think.




reply via email to

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