perf: suppress local-vars hooks in temp buffers

Doom inserts some expensive hooks in MODE-local-vars-hook, like
triggering LSP servers, tree-sitter, or visual enhancements -- things
that are unnecessary in temporary (invisible) buffers, so I suppress
them altogether there.
This commit is contained in:
Henrik Lissner 2024-07-09 20:53:43 -04:00
parent e43d575caf
commit 8bd6b8ab68
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -163,7 +163,12 @@
(defun doom-run-local-var-hooks-h ()
"Run MODE-local-vars-hook after local variables are initialized."
(unless (or doom-inhibit-local-var-hooks delay-mode-hooks)
(unless (or doom-inhibit-local-var-hooks
delay-mode-hooks
;; Don't trigger local-vars hooks in temporary (internal) buffers
(string-prefix-p
" " (buffer-name (or (buffer-base-buffer)
(current-buffer)))))
(setq-local doom-inhibit-local-var-hooks t)
(doom-run-hooks (intern-soft (format "%s-local-vars-hook" major-mode)))))