Emacs Set Frame Title as the file path name

xiaoxiao2021-03-05  23

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)))))))

转载请注明原文地址:https://www.9cbs.com/read-38622.html

New Post(0)