I used to pull it up from the website, but use post-command-hook, refer to the modification, can be displayed in time.
;; 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)
(buffer-file-name (current-buffer))
(buffer-name))))))))))))))))))
; Leet 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)))))))