This might require more tricks than just Emacs-fu, but since Emacs is at the heart of it I hope to get some ideas on how to approach my need here.
I use Emacs/Make/gcc as my development environment. I have a script that watches my source files so that whenever a change is saved it rebuilds, run all tests and updates coverage (thanks cov-mode).
I'm normally running this in a separate terminal window so any compilation errors will show up there, when what I really want is for those errors to end up in a compilation-mode-type buffer in Emacs so I can go to next-error with one key-stroke.
Here are my attempts so far:
- run script in a
term-window- failed to getnext-errorto work - run script in a
shell-window- same problem - run script and collect output in a file which is visited in a buffer - couldn't get that window to auto-update (can I?)
I also want to ensure that next-error is from the last "round", but since the buffer is not cleared on a ^L/clear-command you would have to step through all the errors unknowing when you are actually on a current one.
Update:
I have been exploring writing the output from the script into a file and then forcing my running Emacs to re-read it using auto-revert-mode while still keeping the *compilation*-like behaviour in that buffer. This works, but the problem is that next-error can't be reset to start from the new errors after reverting. Using C-u C-x ` just errors with "Moved past last error". Not even using the after-revert-hook to do (next-error 4 t) seems to do the trick.
How can I reset the next-error "pointer" in this scenario?
Or are there any other approaches I should try?
auto-revert-mode?compileinside Emacs?compileinside Emacs"? Externally making Emacs run the compile through some scripting or PPC? If so how could I do that?