I'd like the :command
of a flycheck checker to depend on the file extension of the input.
For example:
- for
.tex
files run the commandfoo --format latex file.tex
- for any other file extension run the command
foo --format text file.txt
I've tried:
:command ("foo" "--format"
`(if (string= "tex" (file-name-extension source-inplace))
"latex"
"text")
source-inplace)
Which returns:
flycheck-define-command-checker: Invalid command argument (\‘ (if (string= "tex" (file-name-extension source-inplace)) "latex" "text")) in syntax checker textlint
Which is thrown from flycheck when executing flycheck-command-argument-p.
Is it possible to achieve what I'm attempting? i.e the command string passed to :command
being determined by the file extension of the file being checked by flycheck?
For context, the solution was required for implementing a textlint flycheck checker: https://www.macs.hw.ac.uk/~rs46/posts/2018-12-29-textlint-flycheck.html