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

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

Re: global-set-key with function taking arguments


From: William Xu
Subject: Re: global-set-key with function taking arguments
Date: Sun, 01 Nov 2020 14:05:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin)

Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> William Xu wrote:
>
>> You could define a macro wraper around: 
>>
>> (defmacro my-make-interactive (&rest body)
>>   `(lambda ()
>>      (interactive)
>>      (progn ,@body)))
>>
>> (global-set-key (kbd "C-H-<up>") (my-make-interactive (transpose-paragraphs 
>> -1)))
>
> Well, maybe you could, but what would you gain from that?

Not really much, perhaps saving two parens (for writing and reading), compared 
with lambda. :)

I agree, for anything more than a few lines, a custom function would be better. 

-- 
William




reply via email to

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