diff options
| -rw-r--r-- | .emacs | 26 |
1 files changed, 21 insertions, 5 deletions
@@ -343,11 +343,27 @@ (when (not (file-equal-p root "~")) (file-name-nondirectory (string-trim-right root "/"))))) -(setq frame-title-format - '(:eval - (save-match-data ; cf. bug#33697 - (let ((project (my/project-name))) - (concat (when project (format "[%s] " project)) "%b"))))) +(defun my/connection-name () + (when-let ((method (file-remote-p default-directory 'method))) + (if (string-match-p "sudo" method) + method + (format "%s:%s" method (file-remote-p default-directory 'host))))) + +(defun my/frame-title-format () + (let ((prefix + ;; Messing with match data during redisplay is dangerous + ;; (cf. bug#33697). + (save-match-data + ;; For some reason, calling filename-parsing functions + ;; while TRAMP is busy opens the gates to Infinite + ;; Minibuffer Recursion Hell. Cautiously side-step that. + (or + (my/connection-name) + (my/project-name))))) + (concat (when prefix (format "[%s] " prefix)) + "%b"))) + +(setq frame-title-format '(:eval (my/frame-title-format))) (setq-default paragraph-start (concat "[ ]*- \\|" paragraph-start)) |
