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: Tassilo Horn
Subject: Re: A simple implementation of context-sensitive keys
Date: Sat, 13 Sep 2008 09:28:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

"Lennart Borgman (gmail)" <address@hidden> writes:

Hi Lennart,

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

Ok, that's true.  You either have the keymap variable name or the mode
name.  In most cases appending "-map" to the mode name makes the keymap
name.  And even it that fails for some modes, I thing something like

  TAB ist bound to `do-foo' in `foo-mode'.

is not too bad.

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

Maybe an adapted version of `apropos-value' might do the trick.  As it's
now it's much too slow and fails with large keymaps cause it uses their
printed representation as regexp (which gets too long then).  The
`apropos-value' we need can skip everything which is not a list whose
car is 'keymap.  And we don't need to use strings and regexp matching,
but simply `eq'.

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

Yeah, something like that.

Bye,
Tassilo
-- 
* delYsid has mortgage, opportunity and penis in his score file.
<delYsid> thats pretty effective against spam
<Luke> aren't you worried about missing opportunities to mortgage
       your penis?




reply via email to

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