[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: standard framework for prompting user for next key cord in key seque
From: |
Eric Abrahamsen |
Subject: |
Re: standard framework for prompting user for next key cord in key sequence |
Date: |
Sun, 04 Sep 2011 10:33:57 +0800 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/23.2 (gnu/linux) |
On Sun, Sep 04 2011, Le Wang wrote:
> Pressing C-h in the middle of a key sequence shows what's possible
> next. Is there a standard framework, for doing some thing similar,
> without invoking C-h? That is -- always provide the user with
> feedback as to what key chord is possible next. The help window
> should disappear once input is complete successfully or aborted.
>
> (defvar my-map (make-sparse-keymap))
>
> (define-key my-map [(control c) (a)] 'a-func)
> (define-key my-map [(control c) (b)] 'b-func)
>
> (defun cool-fun (func)
> ""
> (interactive (magic-input-helper my-map))
>
> The magic-input-helper is what I'm after here. It seems this should
> be a generally helpful function.
I don't believe there's a standard framework, but for example org-mode
uses "dispatchers" for org-agenda, org-capture and org-export, where you
hit a key and are presented with a menu of options, you could take a
look at how that's done. It won't be so simple as `magic-input-helper',
unfortunately.
E