hack-local-variables before mode hooks
The default behavior is to read file+directory-local variables after the major mode and its hooks have run. I think this is backwards. What if we want to use these local variables to customize the things running in hooks? This does mean hack-local-variables will run at least twice when the mode changes, but this is an acceptable compromise.
This commit is contained in:
parent
05d759fa8b
commit
13cee6870e
1 changed files with 10 additions and 0 deletions
10
core/core.el
10
core/core.el
|
@ -302,6 +302,16 @@ original value of `symbol-file'."
|
||||||
(add-hook 'minibuffer-setup-hook #'doom|defer-garbage-collection)
|
(add-hook 'minibuffer-setup-hook #'doom|defer-garbage-collection)
|
||||||
(add-hook 'minibuffer-exit-hook #'doom|restore-garbage-collection)
|
(add-hook 'minibuffer-exit-hook #'doom|restore-garbage-collection)
|
||||||
|
|
||||||
|
;; The default behavior is to read file+directory-local variables after the
|
||||||
|
;; major mode and its hooks have run. I think this is backwards. What if we want
|
||||||
|
;; to use these local variables to customize the things running in hooks?
|
||||||
|
(defun doom|hack-local-variables ()
|
||||||
|
(with-demoted-errors "File local-variables error: %s"
|
||||||
|
(hack-local-variables 'no-mode)))
|
||||||
|
;; `change-major-mode-hook' is too soon (runs before `kill-all-local-variables'
|
||||||
|
;; is run). `after-change-major-mode-hook' is too late (runs after mode hooks).
|
||||||
|
(add-hook 'change-major-mode-after-body-hook #'doom|hack-local-variables)
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Incremental lazy-loading
|
;; Incremental lazy-loading
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue