I've often found that the default Emacs frame title is a little
bizarre. emacs@host
Seems a little useless at describing what's
going on in the actual window in my opinion, and I believe the space
could be put to much better use. Perhaps it's designed for
environments where X11 forwarding is common practice, or where GNU
Emacs shares a system with XEmacs.
Taking inspiration from both Emacs and Firefox, I came up with a frame title format that I think is much more useful.
(setq frame-title-format '("%b@" (:eval (or (file-remote-p default-directory 'host) system-name)) " — Emacs"))
Instead of emacs@hostname
, I use buffer-name@buffer-host — Emacs
.
Here buffer-name
is the name of the currently focused buffer, and
buffer-host
is the host on which the buffer's file resides. This
means that if you're connected over TRAMP to another host, the remote
host's name will be displayed in the frame title. I then added —
Emacs
at the end, so that it's still obvious which program owns the
window.
It's possible to customize the title a lot more, but this seems to be
a good middle ground for me. frame-title-format
uses the same
formatting template as mode-line-format
, so you can check that
variable with describe-variable
too see all the formatting options
available.