From 66666859939a7a438c075ce7a3e49ea160417ec8 Mon Sep 17 00:00:00 2001 From: Liam Hupfer Date: Sat, 9 Sep 2023 12:07:27 -0500 Subject: [PATCH] fix(emacs-lisp): add elisp flymake load path advice We set flycheck-emacs-lisp-load-path to 'inherit, which evaluates load-path when spawning the Emacs subprocess. flymake relies on a static variable, hence the advice. elisp-flymake-byte-compile is autoloaded by elisp-mode, so there is little reason to condition on `:checkers syntax +flymake`. Ref: https://github.com/flycheck/flycheck/blob/e56e30d8c66ffc9776d07740658d3b542c1a8e21/flycheck.el#L8725-L8727 Ref: https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/elisp-mode.el?h=emacs-29.1#n2166 Ref: https://emacs.stackexchange.com/questions/48661/how-do-i-get-flymake-to-recognize-files-in-my-load-path --- modules/lang/emacs-lisp/config.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/lang/emacs-lisp/config.el b/modules/lang/emacs-lisp/config.el index 1e140a00e..34c88ed16 100644 --- a/modules/lang/emacs-lisp/config.el +++ b/modules/lang/emacs-lisp/config.el @@ -101,6 +101,13 @@ See `+emacs-lisp-non-package-mode' for details.") ;; original in the flycheck instance (see `+emacs-lisp-linter-warnings'). (add-hook 'flycheck-mode-hook #'+emacs-lisp-non-package-mode) + (defadvice! +syntax--fix-elisp-flymake-load-path (orig-fn &rest args) + "Set load path for elisp byte compilation Flymake backend" + :around #'elisp-flymake-byte-compile + (let ((elisp-flymake-byte-compile-load-path + (append elisp-flymake-byte-compile-load-path load-path))) + (apply orig-fn args))) + ;; Enhance elisp syntax highlighting, by highlighting Doom-specific ;; constructs, defined symbols, and truncating :pin's in `package!' calls. (font-lock-add-keywords