[MLton-user] effectively tracking MLton error locations with emacs

Ian Zimmerman itz@buug.org
03 Nov 2004 07:09:33 -0800


Stephen> An annoying problem that I have when using emacs functions to
Stephen> automatically put the cursor at an error is that when visiting
Stephen> multiple errors, once I edit the file, subsequent error
Stephen> locations are off slightly (or even a lot) due to the edits.  I
Stephen> have to manually look around to match up the error message text
Stephen> with the code.

Ian> This used to work.  I'll have to look at the Lisp in Emacs (I use
Ian> GNU Emacs) to see if things changed and why.

I see what the deal is.  Emacs (at least GNU Emacs) works the way it always
has; it sets up the error markers _on demand_ as you request more errors
with C-x ` .  That means if you edit the buffer between the compilation run
and the C-x ` the markers are set up based on the disk copy of the file
and are out of sync at birth.

There is a new compile library in GNU Emacs CVS version (by Daniel Pfeiffer)
that may, or may not, fix this.  In the meantime you could look for a way
to call compilation-parse-errors when the compiler subprocess finishes
(it should be possible with compilation-exit-function).  This would still
leave a window of time during the compile to go out of sync, though.

-- 
"It's not true or not."  A reality show producer (real quote)