From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Jolitz Newsgroups: gmane.emacs.help Subject: Re: Problems with keybindings for functions with arguments Date: Fri, 08 Mar 2013 15:56:21 +0100 Message-ID: <87fw06x7my.fsf@gmail.com> References: <87k3pixa5p.fsf@gmail.com> <87y5dy6kik.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1362754665 8900 80.91.229.3 (8 Mar 2013 14:57:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 8 Mar 2013 14:57:45 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 08 15:58:08 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UDykK-0007Hf-0p for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Mar 2013 15:58:08 +0100 Original-Received: from localhost ([::1]:45363 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDyjy-0007HB-76 for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Mar 2013 09:57:46 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:46765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDyj2-0006J7-Ge for help-gnu-emacs@gnu.org; Fri, 08 Mar 2013 09:56:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UDyiw-0007Dd-PF for help-gnu-emacs@gnu.org; Fri, 08 Mar 2013 09:56:48 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:48715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDyiw-0007DD-JD for help-gnu-emacs@gnu.org; Fri, 08 Mar 2013 09:56:42 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UDyjD-00061u-Tp for help-gnu-emacs@gnu.org; Fri, 08 Mar 2013 15:56:59 +0100 Original-Received: from g231235140.adsl.alicedsl.de ([92.231.235.140]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 08 Mar 2013 15:56:59 +0100 Original-Received: from tjolitz by g231235140.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 08 Mar 2013 15:56:59 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 39 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: g231235140.adsl.alicedsl.de User-Agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.2 (gnu/linux) Cancel-Lock: sha1:GA08sBNUsUDYKEgeMJGWI0g3l+E= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:89419 Archived-At: Jambunathan K writes: > Have you explored this: > > ,---- C-h f interactive > | n -- Number read using minibuffer. > | N -- Numeric prefix arg, or if none, do like code `n'. > | p -- Prefix arg converted to number. Does not do I/O. > `---- yes, thanks, I know these - but they don't answer question 1 (I want only one-key bindings as default case, no extra effort for giving prefix args), and I couldn't figure out how to use them for question 2, i.e. how to make something like this work: ,-------------------------------------------------- | (define-key navi-mode-map (kbd "a") | (lambda (&optional level) (interactive "N") | (and level | (cond | ((eq level 1) (navi-do-stuff argX 1)) | ((eq level 2) (navi-do-stuff argX 2)) | ... | )))) | | | (define-key navi-mode-map (kbd "b") | (lambda (&optional level) (interactive "N") | (and level | (cond | ((eq level 1) (navi-do-stuff argY 1)) | ((eq level 2) (navi-do-stuff argY 2)) | ... | )))) `-------------------------------------------------- -- cheers, Thorsten