forked from purcell/emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit-title-bar.el
25 lines (21 loc) · 977 Bytes
/
init-title-bar.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(defvar *user* (user-login-name) "user login name")
(defvar *hostname*
(let ((n (system-name))) (substring n 0 (string-match "\\." n))) "unqualified host name")
(defun network-location ()
"Report the network location of this computer; only implemented for Macs"
(when *is-a-mac*
(let ((scselect (shell-command-to-string "/usr/sbin/scselect")))
(if (string-match "^ \\* .*(\\(.*\\))$" scselect)
(match-string 1 scselect)))))
(defun concise-network-location ()
(let ((l (network-location)))
(if (and l (not (string-equal "Automatic" l)))
(concat "[" l "]")
"")))
(defun concise-buffer-file-name ()
(when (buffer-file-name)
(replace-regexp-in-string (regexp-quote (getenv "HOME")) "~" (buffer-file-name))))
(setq frame-title-format '("%b - " *user* "@" *hostname*
(:eval (concise-network-location)) " - "
(:eval (concise-buffer-file-name))))
(provide 'init-title-bar)