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
|
%n -- prints Narrow if appropriate
|
||||||
%z -- prints mnemonics of buffer, terminal, and keyboard coding systems
|
%z -- prints mnemonics of buffer, terminal, and keyboard coding systems
|
||||||
%Z -- like %z, but including the end-of-line format"
|
%Z -- like %z, but including the end-of-line format"
|
||||||
(let* ((fs (format-spec-make
|
(let* ((project-name (when (string-match-p "%t" title-format)
|
||||||
?a (when (string-match-p "%a" title-format)
|
(if (boundp 'spacemacs--buffer-project-name)
|
||||||
(abbreviate-file-name (or (buffer-file-name)
|
spacemacs--buffer-project-name
|
||||||
(buffer-name))))
|
(set (make-local-variable 'spacemacs--buffer-project-name)
|
||||||
?t (if (and (string-match-p "%t" title-format)
|
(if (fboundp 'projectile-project-name)
|
||||||
(fboundp 'projectile-project-name))
|
(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
|
?S system-name
|
||||||
?I invocation-name
|
?I invocation-name
|
||||||
?U (or (getenv "USER") "")
|
?U (or (getenv "USER") "")
|
||||||
|
|
Loading…
Reference in a new issue