From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.help Subject: Re: standard framework for prompting user for next key cord in key sequence Date: Sun, 04 Sep 2011 10:33:57 +0800 Message-ID: <8739gdox2i.fsf@ericabrahamsen.net> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1315103661 26881 80.91.229.12 (4 Sep 2011 02:34:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 4 Sep 2011 02:34:21 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Sep 04 04:34:17 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R02XJ-0001h5-Cg for geh-help-gnu-emacs@m.gmane.org; Sun, 04 Sep 2011 04:34:17 +0200 Original-Received: from localhost ([::1]:49278 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R02XI-0007T2-Ta for geh-help-gnu-emacs@m.gmane.org; Sat, 03 Sep 2011 22:34:16 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:50083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R02XE-0007Sv-Dc for help-gnu-emacs@gnu.org; Sat, 03 Sep 2011 22:34:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R02XD-0005Mv-8W for help-gnu-emacs@gnu.org; Sat, 03 Sep 2011 22:34:12 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:43049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R02XC-0005Mq-QG for help-gnu-emacs@gnu.org; Sat, 03 Sep 2011 22:34:11 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R02XB-0001fE-6h for help-gnu-emacs@gnu.org; Sun, 04 Sep 2011 04:34:09 +0200 Original-Received: from 114.250.109.11 ([114.250.109.11]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 04 Sep 2011 04:34:09 +0200 Original-Received: from eric by 114.250.109.11 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 04 Sep 2011 04:34:09 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 27 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 114.250.109.11 User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:Z97Z1QKrmPPjXY+FiZl08r/WWA4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:82137 Archived-At: 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