diff options
| -rw-r--r-- | .emacs | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -632,19 +632,25 @@ UPSTREAMS is a list of fetch URLs." ;;;; Frame title. (defun my/project-root () - (when-let ((project (project-current))) - (car (project-roots project)))) + (and-let* ((project (project-current))) + (project-root project))) (defun my/project-name () - (when-let ((root (my/project-root))) - (when (not (file-equal-p root "~")) - (file-name-nondirectory (string-trim-right root "/"))))) + (and-let* ((root (my/project-root)) + ;; Home is under VC to track dotfile changes. Not a + ;; "project" I want shown in the UI though. + ((not (file-equal-p root "~")))) + (file-name-nondirectory (directory-file-name root)))) (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))))) + (let ((method (file-remote-p default-directory 'method))) + (pcase method + ;; No method: nil. + ('nil method) + ;; sudo(edit): just "METHOD". + ((pred (string-match-p "sudo")) method) + ;; Default: "METHOD:HOST". + (_ (format "%s:%s" method (file-remote-p default-directory 'host)))))) (defun my/frame-title-format () (let ((prefix |
