From 72c3a791324060fd5d04bc27223b0aae1a12ae50 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 2 Jun 2021 23:12:38 -0400 Subject: [PATCH] Ensure *-local-vars-hook runs on hack-local-variables-hook Not sure why I removed this in cd88f65, but it ruins the original purpose of these hooks -- to run after local variables have been set. --- core/core.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/core.el b/core/core.el index 6d3215135dc..c5d076cfeef 100644 --- a/core/core.el +++ b/core/core.el @@ -394,6 +394,14 @@ config.el instead." (setq-local doom-inhibit-local-var-hooks t) (doom-run-hooks (intern-soft (format "%s-local-vars-hook" major-mode))))) +;; If the user has disabled `enable-local-variables', then +;; `hack-local-variables-hook' is never triggered, so we trigger it at the end +;; of `after-change-major-mode-hook': +(defun doom-run-local-var-hooks-maybe-h () + "Run `doom-run-local-var-hooks-h' if `enable-local-variables' is disabled." + (unless enable-local-variables + (doom-run-local-var-hooks-h))) + ;; ;;; Incremental lazy-loading @@ -654,7 +662,8 @@ to least)." (eval-after-load 'straight '(doom-initialize-packages)) ;; Bootstrap the interactive session - (add-hook 'after-change-major-mode-hook #'doom-run-local-var-hooks-h) + (add-hook 'after-change-major-mode-hook #'doom-run-local-var-hooks-maybe-h 100) + (add-hook 'hack-local-variables-hook #'doom-run-local-var-hooks-h) (add-hook 'emacs-startup-hook #'doom-load-packages-incrementally-h) (add-hook 'window-setup-hook #'doom-display-benchmark-h) (doom-run-hook-on 'doom-first-buffer-hook '(find-file-hook doom-switch-buffer-hook))