diff --git a/core/core.el b/core/core.el index d3e1d1e09..8c52c7c35 100644 --- a/core/core.el +++ b/core/core.el @@ -302,6 +302,16 @@ original value of `symbol-file'." (add-hook 'minibuffer-setup-hook #'doom|defer-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