2

In my latex.nanorc file, I have the following instructions:

syntax "LaTeX" "\.(la)?tex$"
linter lacheck

However, when I press the keyboard shortcut to run the linter, I get an error message La commande « lacheck » n'a produit aucune ligne analysable (i.e The 'lacheck' command did not produce any analysable lines in English).

When I run lacheck by its own on my tex file it produces this output:

"article.tex", line 21: missing `\ ' after "e.g.".

My guess is that the format of the message is not understood by nano (version 5.8). Is there a standard protocol a linter must comply to in order to be recognised by nano?

  • When I run lacheck by its own on my tex file it produces "article.tex", line 21: missing \\ ' after "e.g."`. My guess is that the format of the message is not understood by nano –  Jul 28 '21 at 08:38
  • See also: extendsyntax in the nano docs: "This allows you to add a new ... linter ... command to an already defined syntax" – muru Jul 28 '21 at 08:43
  • extendsyntax is just a way to add an instruction to an already defined syntax (for example by an included file) but I'm defining my own syntax from scratch for LaTeX, extendsyntax is irrelevant to me. And since nano refers to lacheck in its error message, my instruction is correctly taken into account –  Jul 28 '21 at 08:45

1 Answers1

2

There's a de facto standard format for compiler or linter error messages, which is the same format as grep -n: FILE_NAME:LINE_NUMBER:MESSAGE. Experimentally, nano supports that. I haven't researched if it supports any other format, but in any case it doesn't support lacheck's format.

You can define a wrapper to the lacheck command that rewrites its messages in the standard format, and tell nano to invoke that wrapper instead of invoking lacheck directly.

#!/usr/bin/env bash
set -o pipefail
lacheck "$@" 2>&1 | sed 's/^"\([^"]*\)", line /\1:/'