David,

On 14 Dec 2014, at 9:23, David Matthews <[email protected]> wrote:

> I seem to recall that the current format of error messages was designed to be 
> parsed by emacs but probably as long ago as the 1980s.  I have no objection 
> at all to changing the format to something more appropriate. It probably 
> needs no more than a change to the bit of code around line 443 in 
> basis/FinalPolyML.sml that assembles a text error message from the location 
> information.  If you want to experiment and send me a patch that works for 
> you I’m happy to look at it.

Here’s a very minor patch to generate Emacs-compatible errors and warnings. See 
below. It’s an SVN diff - hope that works for you.

cheers,
peter

Index: basis/FinalPolyML.sml
===================================================================
--- basis/FinalPolyML.sml       (revision 1980)
+++ basis/FinalPolyML.sml       (working copy)
@@ -441,10 +441,14 @@
             else (* Plain text form. *)
             (
                 printString(concat
-                   ( (if hard then ["Error-"] else ["Warning-"]) @
+                   ( (if file = "" then ["poly: "] else [file, ":"]) @
+                     (if startLine = 0 then [] else [Int.toString startLine]) @
+                     (if startPosition = 0 then [": "] else [".", Int.toString 
startPosition, "-", Int.toString endPosition, ": "]) @
+                     (if hard then ["error: "] else ["warning: "]) ));
+(*                   ( (if hard then ["Error-"] else ["Warning-"]) @
                      (if file = "" then [] else [" in '", file, "',"]) @
                      (if startLine = 0 then [] else [" line ", Int.toString 
startLine]) @
-                     (if startLine = 0 andalso file = "" then [] else 
[".\n"])));
+                     (if startLine = 0 andalso file = "" then [] else 
[".\n"]))); *)
                 PolyML.prettyPrint(printString, !lineLength) fullMessage
             )
         end
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to