mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
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:
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
|
||||||
|
Reference in New Issue
Block a user