unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: help-gnu-emacs@gnu.org
Subject: Re: standard framework for prompting user for next key cord in key sequence
Date: Sun, 04 Sep 2011 10:33:57 +0800	[thread overview]
Message-ID: <8739gdox2i.fsf@ericabrahamsen.net> (raw)
In-Reply-To: CAM=K+io0iX46CnOm-OBTdpA_iAhigHWZ=16p5hpEPctbrPag9A@mail.gmail.com

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




  parent reply	other threads:[~2011-09-04  2:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-03 18:35 standard framework for prompting user for next key cord in key sequence Le Wang
2011-09-03 19:11 ` standard framework for prompting user for next key cord in keysequence Drew Adams
2011-09-04  2:33 ` Eric Abrahamsen [this message]
2011-09-04 19:00 ` standard framework for prompting user for next key cord in key sequence Seweryn Kokot
2011-09-04 20:01   ` Le Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8739gdox2i.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).