On Thu, 15 Mar 2001, Tom Roche wrote:
> Daniel Pittman <[EMAIL PROTECTED]> 6 Mar 2001 14:50:35 +1100
>> Try this for size, it /should/ work (with your key-binging, not mine
>> :):
>
>> (define-key global-map [(control f10)]
>> (lambda (&rest args)
>
> I _knew_ there was a better way than &optional ...
Point of view, really. &rest accepts zero or more arguments, &optional
accepts zero or one. It makes little difference if you only ignore them.
Be aware, though, that &rest gives you a /list/ of all the arguments,
even if there was only one. :)
>> (interactive)
>> (if (tramp-file-p ...)
>> (call-interactively 'tramp-compile)
>> (call-interactively 'compile))))
>
>> That should be a little more like what you want.
>
>> Basically, that passes the call on to the correct version of the
>> compile command (tramp or otherwise) as though they had been called
>> from the keypress.
>
> Looks cleaner than mine: so I do
>
> (define-key global-map "\M-`"
> (lambda (&rest args)
> "Use 'tramp-compile' if in a tramp buffer, 'compile' otherwise."
> (interactive)
> (if (tramp-tramp-file-p buffer-file-name)
> (call-interactively 'tramp-compile)
> (call-interactively 'compile)
> )
> )
> )
>
> and ... it works! Todo: learn more elisp :-)
Hey, isn't that what you have been doing?
Daniel
--
If you do what you should not, you must bear what you would not.
-- Ben Franklin