all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rafael <rvf0068@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to bind a function with argument?
Date: Fri, 17 Dec 2010 20:03:46 -0600	[thread overview]
Message-ID: <87lj3n3khp.fsf@gmail.com> (raw)
In-Reply-To: 87pqszu9yh.fsf@kuiper.lan.informatimago.com

"Pascal J. Bourguignon" <pjb@informatimago.com> writes:

> Rafael <rvf0068@gmail.com> 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!


      parent reply	other threads:[~2010-12-18  2:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-18  0:35 How to bind a function with argument? Rafael
2010-12-18  1:31 ` LanX
2010-12-18  1:43   ` Rafael
2010-12-18  1:52   ` LanX
2010-12-18  1:49 ` Pascal J. Bourguignon
2010-12-18  2:00   ` LanX
2010-12-18  2:03   ` Rafael [this message]

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

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

  git send-email \
    --in-reply-to=87lj3n3khp.fsf@gmail.com \
    --to=rvf0068@gmail.com \
    --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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.