why my frame-title-format does not work?

advertisements

my emacs' version: GNU Emacs 24.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.10.9) of 2014-05-21 on buildvm-07.phx2.fedoraproject.org

I hope Emacs's title display the absolute path of the current file. I wrote the following contents (from internet):

;;;Emacs title bar to reflect file name
(defun frame-title-string ()
   "Return the file name of current buffer, using ~ if under home directory"
(let
  ((fname (or
             (buffer-file-name (current-buffer))
             (buffer-name))))
 ;;let body
  (when (string-match (getenv "HOME") fname)
    (setq fname (replace-match "~" t t fname))        )
  fname))

 ;;; Title = 'system-name File: foo.bar'
(setq frame-title-format '("" system-name "  File: "(:eval (frame-title-string))))

before reinstalling FC20 + Emacs, the above content was able to work correctly. Now it does not work except that I open .emacs and eval frame-title-format manually, I do not know why I must manually eval it?


I was affected by the same problem. On CentOS 7 and Fedora 21 systems, I found that /usr/share/emacs/site-lisp/default.el overrides frame-title-format (and nothing else). Presumably Fedora 20 has the same issue. The same file contains instructions for disabling this ("Setting inhibit-default-init non-nil in ~/.emacs") which worked for me.

The answer that @abelard20008 refers to does the same thing.