[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A simple implementation of context-sensitive keys
From: |
Stefan Monnier |
Subject: |
Re: A simple implementation of context-sensitive keys |
Date: |
Wed, 10 Sep 2008 13:49:48 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
> So I've come up with this macro, which creates such a dispatching
> command automagically. If none of the context predicates match, the
> default command bound to the key will be executed.
Another way to get a similar result is:
(define-key <map> <key> '(menu-item "dummy" <binding>
:filter (lambda (binding)
(when <condition> binding))))
It's tempting to use the :enable property instead of :filter, but sadly,
the :enable property is only obeyed by the menu-construction code, not
by the key-lookup code.
In any case, the main problem with such things (whichever way they're
implemented) is that the rest of Emacs doesn't know and/or expect such
condition bindings, so C-h k gives only partial information, and
similarly where-is doesn't know how to tell the whole story.
Stefan
- Re: A simple implementation of context-sensitive keys, (continued)
Re: A simple implementation of context-sensitive keys,
Stefan Monnier <=
Re: A simple implementation of context-sensitive keys, Lennart Borgman (gmail), 2008/09/11
Re: A simple implementation of context-sensitive keys, Lennart Borgman (gmail), 2008/09/11
Re: A simple implementation of context-sensitive keys, Tassilo Horn, 2008/09/11
Re: A simple implementation of context-sensitive keys, Lennart Borgman (gmail), 2008/09/11
Re: A simple implementation of context-sensitive keys, Tassilo Horn, 2008/09/12