From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rafael Newsgroups: gmane.emacs.help Subject: Re: How to bind a function with argument? Date: Fri, 17 Dec 2010 20:03:46 -0600 Organization: A noiseless patient Spider Message-ID: <87lj3n3khp.fsf@gmail.com> References: <87ei9fsytj.fsf@gmail.com> <87pqszu9yh.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1292650745 13156 80.91.229.12 (18 Dec 2010 05:39:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 18 Dec 2010 05:39:05 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Dec 18 06:39:00 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PTpVU-0006dR-9q for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Dec 2010 06:39:00 +0100 Original-Received: from localhost ([127.0.0.1]:46576 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTpVT-00050d-R2 for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Dec 2010 00:38:59 -0500 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!news2.euro.net!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 35 Injection-Info: mx03.eternal-september.org; posting-host="3L/Zo662uz+nGEbotdkMvw"; logging-data="5907"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TCzrDRcrSv5U5B9hlgVpO" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:yodwiLdPmY+az7RBCzCHXwEwUmM= sha1:ZlPXTjaUFE3NpDwf8amo5ViZl7Y= Original-Xref: usenet.stanford.edu gnu.emacs.help:183396 X-Mailman-Approved-At: Sat, 18 Dec 2010 00:30:26 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:77653 Archived-At: "Pascal J. Bourguignon" writes: > Rafael writes: > >> I would like to bind a key to the function that results from >> >> C-u M-x org-insert-link >> >> From 4.6 of http://www.nongnu.org/emacs-tiny-tools/keybindings/, I >> thought that >> >> (global-set-key [(super f)] >> '(lambda () (interactive) (org-insert-link 4))) >> >> would do the trick. But it doesn't, the effect is no different than just >> doing >> >> (global-set-key [(super f)] 'org-insert-link) >> >> which is not what I want. Any help, please? > > Read the documentation of org-insert-link. Follow the link to the > source. See that it has a (interactive "P") declaration. Read the > documentation of interactive. See that "P" means prefix arg in raw > form. > > If you don't know it, search in emacs lisp documentation, and you'll > find that the prefix arg in raw form, for a single C-u, is passed as > (4), not 4, and for C-u C-u, it's (16). > > So it should be: > > (global-set-key [(super f)] (lambda () (interactive) (org-insert-link '(4)))) Indeed it should. Thanks Pascal, for your detailed answer, and LanX!