Reputation: 1743
I'm using Gnu emacs in Windows XP, and the default window title reads "emacs@ACH1797VM2" rather than the buffer title, which is what I want and which is the correct default behavior, as far as I know.
After reading https://stackoverflow.com/a/2338352/1001165, I put the following line at the end of my ~/.emacs file, but there's no change in the behavior.
(setq frame-title-format "%b - emacs")
I can change the window title just fine with
M-x set-frame-name NewName RET
but I want it to change automatically to match the buffer name.
Upvotes: 5
Views: 3625
Reputation: 1376
You can try this, add to your .emacs:
(setq frame-title-format
'((:eval (if (buffer-file-name)
(abbreviate-file-name (buffer-file-name))
"%b"))
(:eval (if (buffer-modified-p)
" •"))
" Emacs")
)
%b -- print buffer name . You can see more options here. Besides, if you are modifying any buffer, the " • " will show to indicate that you are modifying and that there are unsaved changes.
Hope to helped.
Upvotes: 6
Reputation: 581
I rather think this means the title at the top of the window, not the bit in the grey bar inside Emacs. It's useful to change this so that you can distinguish between different windows when going Alt+TAB or in the task bar.
I found this, which works for me to show the name of the buffer in which the cursor is focused:
(setq frame-title-format "%b - Emacs")
Link.
Upvotes: 3
Reputation: 5877
This is what lying around in my .emacs. not sure it has any effect.
(setq-default frame-title-format '(buffer-file-name "%f" "%b")) ; I already know this is Emacs
Upvotes: 1
Reputation: 7839
I'd say the line is correct. You can copy & paste the expression into the *scratch*
buffer and hit C-J. If the window title changes, then it should change too when you add the line in your .init.el
. There's also the possibility that your init file is not in the right place or it's not named correctly... if I recall correctly in Windows it doesn't start with a dot, but with an underscore.
Upvotes: 4