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: Thu, 11 Sep 2008 22:38:30 +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 (gmail)" <address@hidden> writes:
> 
> Hi!
> 
>>> Currently the problem of which minor mode gets the key press is
>>> resolved just by the corresponding minor mode's position in
>>> minor-mode-map-alist.  The first one gets it.
>> Eh, and maybe I should have added that it is easier to understand what
>> I am talking about after looking here:
>>
>>   (info "(elisp) Searching Keymaps")
> 
> So I guess a first step into the right direction would be to enhance
> `describe-key' that it doesn't stop if KEY is found, but to list the
> shadowed commands, too.  Something like

If you say that this is the first step so, yes ... ;-)

> ,----
> | TAB (translated from <tab>) runs the command message-tab, which is an
> | interactive compiled Lisp function in
> | `/usr/share/emacs/23.0.60/lisp/gnus/message.el'.
> | 
> | It is bound to TAB in `message-mode-map'.  <== This is new

There is currently no function in Emacs to find the keymap variable
name. However I wrote the command `describe-key-and-map-briefly' that
tries to find the keymap variable name. This is a bit tricky and I am
sure that you can construct cases where it does not work. However so far
I have not found any example where it does not work.

Here is the output from it

  <f1> c is bound to `describe-key-and-map-briefly' in `global-map'

and here is the output from `describe-key-briefly' (the default binding
for <f1> c):

  <f1> c runs the command describe-key-and-map-briefly

The function is in this file

http://bazaar.launchpad.net/~nxhtml/nxhtml/main/annotate/52?file_id=ourcommentsutil.el-20080724174035-zgon4j679232cch3-182


> | (message-tab)
> | 
> | Complete names according to `message-completion-alist'.
> | Execute function specified by `message-tab-body-function' when not in
> | those headers.
> | 
> | It shadows the following commands:         <== This is new
> | 
> |   `foo'    (bound to TAB in `foo-mode-map')
> |   `bar'    (bound to TAB in `bar-mode-map')
> |   ...
> `----

Yes, something like that.

> Bye,
> Tassilo




reply via email to

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