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

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

Re: Basic elisp question: bind key to function with arg


From: Marcin Borkowski
Subject: Re: Basic elisp question: bind key to function with arg
Date: Mon, 26 Jan 2015 00:57:10 +0100

On 2015-01-26, at 00:16, Dmitry Gutov <dgutov@yandex.ru> wrote:

> On 01/26/2015 01:12 AM, torys.anderson@gmail.com (Tory S. Anderson) wrote:
>> I have the following in my emacs init, and it works fine:
>>
>>      (global-set-key [C-up] 'enlarge-window)
>>      (global-set-key [C-down] (lambda () (interactive)
>>                                 (enlarge-window -1)))
>>
>> But it seems awkward to me that I need to add all the extra just to pass a 
>> -1 arg to the function, so I'm suspecting there's a simpler way to write 
>> this. Any tips?
>
> No, that's how you do it. Or you create a named function doing the same, 
> and bind it instead.

And creating a named function is imho slightly better, since the result
of C-h c is not very readable with a lambda.

Hth,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

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