I want to set the frame title as follows:
- When the current buffer is visiting a file, show the full path name and the Emacs version.
- When the current buffer has no file, then show the buffer name and the Emacs version.
In my init.el
, I put
(setq-default frame-title-format
(concat (if (buffer-file-name) "%f" "%b") " - " (substring (emacs-version) 0 15)))
Why doesn't my code print the file name with the full path?
(symbol then else)
form formode-line-format
, nice one. – rpluim Nov 15 '18 at 15:31(format " - GNU Emacs %s" emacs-version)
is a constant and is known when Emacs starts. If you use'(:eval (format ...))
, Emacs will compute it whenever the frame title needs to be updated, which is unnecessary. – xuchunyang Nov 15 '18 at 17:26