[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: binding a key to a function with an argument
From: |
Teemu Likonen |
Subject: |
Re: binding a key to a function with an argument |
Date: |
Thu, 23 Jul 2009 08:42:59 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
On 2009-07-22 09:13 (-0700), John Withers wrote:
> (global-set-key (kbd "C-x C-s") 'save--some-buffers)
>
> but I can't figure out how to pass the non-nil argument. I have tried a
> few different ways and they all throw errors.
The second parameter for global-set-key must be a symbol of interactive
function and you can only pass interactive prefix arguments to that
function. But you can create a new function which calls
save-some-buffers with the arguments you like. I use anonymous function
(lambda) here:
(global-set-key (kbd "C-x C-s")
(lambda () (interactive)
(save-some-buffers t)))