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

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

Re: hostname and filename as frame title


From: Suvayu Ali
Subject: Re: hostname and filename as frame title
Date: Sun, 14 Feb 2010 13:01:44 -0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100120 Fedora/3.0.1-1.fc11 Lightning/1.0b2pre Thunderbird/3.0.1

On Friday 12 February 2010 01:35 AM, Michael Albinus wrote:
Suvayu Ali<fatkasuvayu+linux@gmail.com>  writes:

Hi everyone,

Hi,


I do a lot of remote editing on several remote machines. I recently
came across the variable `frame-title-format' and was wondering if
there is a way to set the hostname of the file being edited and the
file name as the frame title? Something like file@remote-host.

I don't even know where to start looking, any pointers would be awesome. :)

What about this:

(setq-default
  frame-title-format
  '(:eval
    (format "%s@%s:%s"
           (or (file-remote-p default-directory 'user) user-login-name)
           (or (file-remote-p default-directory 'host) system-name)
           (file-name-nondirectory (or (buffer-file-name) default-directory)))))


I ended up using something like this. This sets the frame-title to just the buffer-name for special buffers and uses the buffer name as set by uniquify when visiting files with same names. Maybe some one else will find this useful.

(setq-default
 frame-title-format
 '(:eval
   (if (string-match-p "^\\*.+\\*$" (buffer-name))
       "%b"
     (format "%s:%s"
             (or (file-remote-p default-directory 'host) system-name)
             (buffer-name)))))

:)
--
Suvayu

Open source is the future. It sets us free.




reply via email to

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