diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-16 06:13:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-16 06:13:34 -0500 |
| commit | 541bc2680adeda454d60e5d3938f3e91b987929b (patch) | |
| tree | 16a4a8eb8ab2a0f26fb4c02caff50a9f418fdd3b /modules | |
| parent | 0cef2df628d2e89b62273f2a2c951278831d6fd9 (diff) | |
| download | dotemacs-541bc2680adeda454d60e5d3938f3e91b987929b.tar.gz dotemacs-541bc2680adeda454d60e5d3938f3e91b987929b.zip | |
fix(flycheck): wrap languagetool checker definition in eval+backquote
flycheck's `flycheck-define-checker' macro requires the `:command'
executable to be a string literal at macro-expansion time -- it does
`(stringp (car command))' and errors otherwise. The previous
`(eval (expand-file-name ...))' form (commit ad3b7617, the
externalization fix) put a `(eval FORM)' wrapper in the executable
position, which flycheck rejected at load:
Error (use-package): recentf/:config: Command executable for
syntax checker languagetool must be a string:
(eval (expand-file-name "scripts/languagetool-flycheck"
user-emacs-directory))
`(eval FORM)' is only valid for SUBSEQUENT command-list elements
(arguments), not the executable.
Wrap the entire `flycheck-define-checker' invocation in `eval' +
backquote so the expanded path is spliced in as a string literal
before the macro sees it. The hardcoded `~/.emacs.d/...' path is
gone for the same reason the original externalization wanted it
gone: survives a non-standard `user-emacs-directory'.
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/flycheck-config.el | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/modules/flycheck-config.el b/modules/flycheck-config.el index ba408b52f..f064cb137 100644 --- a/modules/flycheck-config.el +++ b/modules/flycheck-config.el @@ -66,17 +66,22 @@ ;; use the load-path of the currently running Emacs instance (setq flycheck-emacs-lisp-load-path 'inherit) - ;; Define LanguageTool checker for comprehensive grammar checking - (flycheck-define-checker languagetool - "A grammar checker using LanguageTool. + ;; Define LanguageTool checker for comprehensive grammar checking. + ;; The :command executable must be a string literal at macro-expansion + ;; time (flycheck rejects `(eval ...)' in the first position), so we + ;; backquote-splice the expanded path into the form and eval it + ;; explicitly. Survives a non-standard `user-emacs-directory'. + (eval + `(flycheck-define-checker languagetool + "A grammar checker using LanguageTool. Uses a wrapper script to format output for flycheck." - :command ((eval (expand-file-name "scripts/languagetool-flycheck" - user-emacs-directory)) - source-inplace) - :error-patterns - ((warning line-start (file-name) ":" line ":" column ": " - (message) line-end)) - :modes (text-mode markdown-mode gfm-mode org-mode)) + :command (,(expand-file-name "scripts/languagetool-flycheck" + user-emacs-directory) + source-inplace) + :error-patterns + ((warning line-start (file-name) ":" line ":" column ": " + (message) line-end)) + :modes (text-mode markdown-mode gfm-mode org-mode))) (add-to-list 'flycheck-checkers 'languagetool) (defun cj/flycheck-list-errors () |
