https://godoc.org/github.com/mkhl/cmd/acme/autoacme
When invoked like this
autoacme acme-onevent
it will execute its argument for each event in the acme log, i.e. an event like this
42 put /path/to/file.ext
will result in autoacme executing something like
winid=42 acme-onevent put /path/to/file.ext
and whatever happens from there is up to you!
I use something similar to the included script to run formatters and possibly linters, although I’m not sure how best to run both yet.
https://godoc.org/github.com/mkhl/cmd/acme/acmepipe
Along the way I learned that making an Acme window
Get
its file cleared the undo stack,
so to help with that I wrote acmepipe.
It is similar in spirit to both Fmt and apipe.
The main difference to those tools
is that acmepipe does not assume
that is’s running inside Acme
and explicitly writes diagnostic output (stderr)
to acme/$winid/errors
.
When I started writing autoacme,
I planned to run formatters on put
and linters on get
,
and specifically to run formatters
so they’d modify the file directly
and then to write get
to acme/$winid/ctl
,
which would reload the changed file
and also trigger the linter.
As I noted above though,
Get
clears the undo stack,
so I decided to use a different approach,
but now I’m short a nice hook to trigger linters from.
The get
event doesn’t work as nicely
because it’s cumbersome to invoke manually,
put
will currently report wrong line numbers
if the source was modified by a formatter,
focus
would probably be obnoxious.
I’m not sure how to approach these yet.