diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2019-12-23 13:58:55 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2019-12-23 13:58:55 +0100 |
| commit | 7edcb0729df7c8bcc2dc0b4539bb7371fc468edd (patch) | |
| tree | 670490bd79f92a263796db3514b8844a5181aa44 | |
| parent | bfeeb48b792d5ada9c9deffb91b7d851cef53ad2 (diff) | |
| download | dotfiles-7edcb0729df7c8bcc2dc0b4539bb7371fc468edd.tar.xz | |
Prevent minibuffer seizures when setting frame title
For reasons not entirely clear, the password prompt would get stuck
when trying to sudoedit a file. minibuffer-depth-indicate-mode told
me that I was 16 prompts deep. I'll chalk if off to my/project-name
calling functions it shouldn't call when TRAMP is busy.
| -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)) |
