help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to bind a function with argument?


From: Rafael
Subject: Re: How to bind a function with argument?
Date: Fri, 17 Dec 2010 20:03:46 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

"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!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]