bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#7727: describe-key doesn't tell whole redirect sequence


From: Stefan Monnier
Subject: bug#7727: describe-key doesn't tell whole redirect sequence
Date: Mon, 24 Jan 2011 22:09:10 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>> A cleaner could look like the following: add dynamic keymaps to Emacs,
>> where "dynamic keymaps" are represented as functions/objects a bit like
>> functional completion tables.
> Hm...  how would that work?

> The complicated run-summary-commands-from-the-article-buffer thing is
> quite, er, complicated, because some commands need to keep the window
> conf, while others shouldn't, and stuff.

I haven't worked it out, so I can't really answer.  In PCL-CVS I had
a similar situation, except that I used a prefix key, so <prefix> <key>
in a derived buffer would call the command bound to <prefix> in the main
buffer, so I didn't need to play tricks with the keymap.  But I had to
make the commands themselves work in "any" buffer, and indeed, that had
to be done differently for each command.

How would the dynamic keymap enter the picture: rather than substitute
"undefined => gnus-article-read-summary-keys" and fool around
describe-key and friends, you'd set article-mode's parent keymap to
a dynamic keymap, i.e. a function that takes the current key as argument
and needs to return the command to which this key is bound (or nil), so
this function can lookup summary mode's keymap and return a command that
performs <summary-command> but that works from the article buffer.
You can do this last step either by making all summary command work in
the article buffer (as I did in PCL-CVS) or by dynamically wrapping the
command into a new command (which would do something similar to
gnus-article-read-summary-keys, except it takes the <summary-command>
as argument rather than a key-sequence).

The main benefit is that the keymapping is made clear to describe-key,
so you wouldn't need gnus-article-describe-key and friends.  Of course,
all this is hypothetical since we don't have dynamic keymaps.
As for me, the main reason why I want dynamic keymaps is for use in
function-key-map where I'd move most of the "fallback" thingies from
read-key-sequence (e.g. A => a, double-mouse-2 => mouse-2, down-mouse-2
=> nil, ...) and where we could place generic remappings like "any
modifiers + mouse-4 => same modifiers + wheel-up".


        Stefan





reply via email to

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