help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Remote files, tramp, colors


From: Kevin Rodgers
Subject: Re: Remote files, tramp, colors
Date: Mon, 14 Jul 2003 16:09:22 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

PASZTOR Miklos wrote:

 I have just discovered tramp, and I am quite enthusiasistic.  I work on a
 bunch of machines, and I used to set different background colors in remote
 .emacs files so that I can see immediately what is the machine I am the
 file editing on.  Now I would like to retain this with tramp.

 How can I have automatically different background colors depending on the
 machine part of the current buffer name ?

I'm not a tramp user, but here's a stab in the dark:

(require 'tramp)

(defun pasztor-set-background-color ()
  "*Set the background color according to the remote file name."
  (interactive)
  (if buffer-file-name
      (with-parsed-tramp-file-name buffer-file-name 'tramp
        (let ((host (tramp-host buffer-file-name)))
          (cond ((equal tramp-host "foo") (set-background-color "blue"))
                ((equal tramp-host "bar") (set-background-color "red"))
                ...
                (t (set-background-color "black")))))))

(add-hook 'find-file-hooks 'pasztor-set-background-color)
(add-hook 'find-file-not-found-hooks 'pasztor-set-background-color)

--
Kevin Rodgers



reply via email to

[Prev in Thread] Current Thread [Next in Thread]