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

Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %; q to quit; ? for help.

and if I do it again,

[2 times]

gets appended.

> 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

(define-key global-map "\M-`"
  (lambda (&optional arg)
    (interactive)
    (if (tramp-tramp-file-p buffer-file-name)
        (tramp-compile)
        (compile)
    )
  )
)

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

> Wrong number of arguments: #[(command) "Ã
> ?Ä\"ˆŠÅÆÇ!È\"ˆÉ ˆ)ÊËÇ!\"ˆÅËÇ!!ˆÌÍ!‡" [command
> compile-command compilation-ask-about-save save-some-buffers nil
> pop-to-buffer get-buffer-create "*Compilation*" t erase-buffer] 4
> ("n:/site-lisp/tramp-2.9/lisp/tramp-util.elc" . 607) (byte-code
> "„

So I delete tramp-util.elc (hoping to avoid bytecode), start another
emacs with -debug-init, eval it again, and run it again: I get (broken
for mail)

*Backtrace*
> Signaling: (wrong-number-of-arguments #[(command) "^H^Qà ?Ä\"ˆÅ
> Æ\"‡" [command compile-command compilation-ask-about-save
> save-some-buffers nil compile-internal "No more errors"] 3
> ("n:/emacs-20.7/lisp/progmodes/compile.elc" . 13898) (byte-code
> "^H„^H
>   compile()
>   (if (tramp-tramp-file-p buffer-file-name) (tramp-compile) (compile))
> (lambda (&optional arg) (interactive) (if (tramp-tramp-file-p
>   buffer-file-name) (tramp-compile) (compile)))()
> call-interactively((lambda (&optional arg) (interactive) (if
>   (tramp-tramp-file-p buffer-file-name) (tramp-compile) (compile))))

Any suggestions? (Like, how to avoid the linenoise without deleting
all my .elc's ?-)

Your assistance is appreciated, [EMAIL PROTECTED]

Reply via email to