Cache expensive computations in spacemacs/title-prepare
This commit is contained in:
parent
4929f62a70
commit
2d7737cd3e
|
@ -681,14 +681,22 @@ If ARG is non nil then Ask questions to the user before installing the dotfile."
|
|||
%n -- prints Narrow if appropriate
|
||||
%z -- prints mnemonics of buffer, terminal, and keyboard coding systems
|
||||
%Z -- like %z, but including the end-of-line format"
|
||||
(let* ((fs (format-spec-make
|
||||
?a (when (string-match-p "%a" title-format)
|
||||
(abbreviate-file-name (or (buffer-file-name)
|
||||
(buffer-name))))
|
||||
?t (if (and (string-match-p "%t" title-format)
|
||||
(fboundp 'projectile-project-name))
|
||||
(let* ((project-name (when (string-match-p "%t" title-format)
|
||||
(if (boundp 'spacemacs--buffer-project-name)
|
||||
spacemacs--buffer-project-name
|
||||
(set (make-local-variable 'spacemacs--buffer-project-name)
|
||||
(if (fboundp 'projectile-project-name)
|
||||
(projectile-project-name)
|
||||
"-")
|
||||
"-")))))
|
||||
(abbreviated-file-name (when (string-match-p "%a" title-format)
|
||||
(if (boundp 'spacemacs--buffer-abbreviated-filename)
|
||||
spacemacs--buffer-abbreviated-filename
|
||||
(set (make-local-variable 'spacemacs--buffer-abbreviated-filename)
|
||||
(abbreviate-file-name (or (buffer-file-name)
|
||||
(buffer-name)))))))
|
||||
(fs (format-spec-make
|
||||
?a abbreviated-file-name
|
||||
?t project-name
|
||||
?S system-name
|
||||
?I invocation-name
|
||||
?U (or (getenv "USER") "")
|
||||
|
|
Loading…
Reference in a new issue