Open zenMaya opened 1 year ago
Why not create another package flymake-zig
? Probably cleaner this way. 🤔
Every version of Emacs that zig-mode supports has a compatible modern flymake
included, so here I wouldn't recommend splitting it into a separate package: it's fairly common and reasonable for a major mode to bundle some basic flymake support. I have some comments on the specifics of this PR, though, which I'll leave in a quick review.
Flymake is a pretty good backend to report compiler errors to. Better than
compilation-mode
. This commit allows, if user callsflymake-mode
, to automatically call a zig command. It iszig build test
but can bezig ast-check
or similar. The errors are automatically reported to the buffer. This works project-wide with correct locations.However, a small limitation is, that only one process can be spawned. This is because otherwise there would be much more code to check in a alist. (key would be either
(project-current)
or if nil(current-buffer)
)I don't think it is a huge limitation, as the commands runs project-wide and most people won't run more than one project check at a time.
In the reference implementation the command is ran per buffer, which this implementation does not support. And that is why the limitation is here compared to the flymake manual (https://www.gnu.org/software/emacs/manual/html_node/flymake/An-annotated-example-backend.html).