Linux Emacs – Why Is Hostname Different in Emacs

emacshostnamelinux

So I changed the name of my computer recently, by editing /etc/hostname. The bash prompt is user@name, so I know it has worked.

But in emacs, in the window bar it says emacs@name.tiscali.co.uk. Tiscali is my internet provider. Before I changed it, emacs just had emacs@oldname in the window bar.

How can I remove my IP's name from the window bar in emacs?

Best Answer

The name in /etc/hostname is what your computer thinks it's called. That's often what is meant by hostname.

Computers connected to the Internet (including intranets) have names; more precisely, most Internet network interfaces have a name associated with their IP address. Internet nodes that are not routers generally have a single network interface worth consideration, and the name associated to this interface is called its fully qualified domain name (FQDN). The FQDN is the name you can use to designate your computer from any other Internet node (well, assuming there are no complex configurations involved). Generally, to keep confusion down, the FQDN is something like foo.example.com where foo is the host name.


When you have a single frame open, Emacs uses the value of the system-name variable as the frame title. This variable is set to the FQDN when Emacs starts. You can change it from your .emacs if you wish. This variable isn't used much, so don't worry about changing it. It is used to form a default email address when you send mail or news posts from within Emacs, but you'd almost always override that email address setting anyway.

The frame title format is determined by the frame-title-format variable (unless overridden for a specific frame). You can change it if you'd like to use something other than system-name when there is a single frame. For example, if you want to always see the buffer name in the frame title (as opposed to when there is only one Emacs frame), you can set it to "%b".

Related Question