On Thu, 15 Mar 2001, Tom Roche wrote:
> On Thu, 15 Mar 2001, Tom Roche wrote:
[...]
> Daniel Pittman <[EMAIL PROTECTED]> 16 Mar 2001 10:48:11 +1100
>> Trying to bind a function that isn't interactive to a key sequence.
>> Add an `interactive' form to the top of the function.
>
> Actually, I had tried that. If I do
>
>> (define-key global-map "\M-`"
>> (interactive)
>> (lambda (&optional arg)
>> (if (tramp-tramp-file-p buffer-file-name)
>> 'tramp-compile
>> 'compile
>> )
>> )
>> )
>
> I get
>
>> Wrong number of arguments: #<subr define-key>, 4
Ah. I see the problem. You want:
(define-key global-map "\M-`"
(lambda (&optional arg)
(interactive)
(if (tramp-tramp-file-p buffer-file-name)
'tramp-compile
'compile
)
)
)
The `interactive' form belongs to the function - in this case, the
function you construct on the fly with `lambda'.
Daniel
--
When I admire the wonder of a sunset or the beauty of the moon,
my soul expands in worship of the Creator.
-- Mohandas K. Gandhi