On Thu, 15 Mar 2001, Tom Roche wrote:
> Daniel Pittman <[EMAIL PROTECTED]> 16 Mar 2001 11:18:38 +1100
>>>> You want:
> 
>>>> (define-key global-map "\M-`"
>>>>   (lambda (&optional arg)
>>>>     (interactive)
>>>>     (if (tramp-tramp-file-p buffer-file-name)
>>>>         'tramp-compile
>>>>         'compile
>>>>     )
>>>>   )
>>>> )
> 
>>>> Umm ... I tried that. Is there a typo?
> 
>> Probably. I didn't actually test it. :)
> 
>> Hang on...  It /looks/ right. Let me check my own sources.
> 
>>> I can eval the above, checking to see that the key bound (it has).
>>> But if I try to use the key, nothing happens.
> 
>>> Ah. Wait. I see it. Let me guess, in the minibuffer, you see either
>>> "compile" or "tramp-compile" when you hit the key, right?
> 
> I see nothing. There's nothing in *Messages*, either. Oops, I take
> that back: there's a suspicious

Maybe. It's possible the command loop silently eats the symbol; it
wouldn't surprise me.

[...]

>> You are returning a symbol from the keypress function which is then
>> ignored. You actually need to /call/ the function you want run.
> 
>> So, rather than doing (if ... 'tramp-compile 'compile), run the
>> command you want, so:
> 
>> (if ... (tramp-compile) (compile))
> 
> OK, I eval

[...]

> and I get noise in *Messages* (broken for mail):

The noise is a byte-compiled version of the compile function. It takes a
parameter, the event that started it.

So, you need to pass arg from your lambda to `compile'. :)

        Daniel

-- 
People of privilege will always risk their complete destruction
rather than surrender any material part of their advantage.
        -- John Kenneth Galbraith, _The Age of Uncertainty_ (1977)

Reply via email to