Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005070OCamlOCaml generalpublic2010-06-13 19:452015-02-06 19:35
Assigned Todoligez 
PlatformOSOS Version
Product Version3.11.2 
Target Version4.03.0+devFixed in Version 
Summary0005070: Error location output not supported by emacs
Descriptionif I compile the following:

let foo : int =

it gives me the error

File "/home/palomer/temp/", line 2, characters 1-21:

when the next-error function in emacs expects the following:

File "/home/palomer/temp/", line 2-4, characters 1-8:

Additional Informationan easy fix would be to change the "print" function in "parsing/" to the following:

let print ppf loc =
  let ls = loc.loc_start in
  let le = loc.loc_end in
  let lines =
    if ls.Lexing.pos_lnum = le.Lexing.pos_lnum then
      sprintf "line %d" ls.Lexing.pos_lnum
      sprintf "lines %d-%d" ls.Lexing.pos_lnum le.Lexing.pos_lnum
  fprintf ppf "File \"%s\", %s, characters %d-%d:\n" ls.Lexing.pos_fname
         lines (ls.Lexing.pos_cnum - ls.Lexing.pos_bol)
         (le.Lexing.pos_cnum - le.Lexing.pos_bol)

And the "to_string" function in "camlp4/Camlp4/Struct/" might also have to be similarly changed
TagsNo tags attached.
Attached Files

- Relationships
related to 0004659closedfrisch wrong error message (parser seems to interpret many lines as one line) (3.10.2 and 3.10.0) 
related to 0005044acknowledged Emacs doesn't recognize the backtrace error location format 
has duplicate 0006518acknowledged Consider supporting GNU-style error messages 

-  Notes
doligez (administrator)
2011-06-01 23:13

Now that emacs supports character positions in error messages, I guess we should change our format, but we will also need to change the corresponding regexp in caml.el.

In the meantime, you should consider using caml-mode in your emacs.
doligez (administrator)
2012-08-08 16:53
edited on: 2012-08-08 17:26

First step toward fixing this: I have defined a new format for the error messages:

File "foo", line 1, char 2 to line 3, char 4:

Where "4" is the char number within line 3 (not a char offset from line 1).
I have added to caml.el the corresponding regexp, in addition to the old one. (r 12840 and 12843 in trunk)

OCaml still outputs the old format for the moment.

doligez (administrator)
2015-02-06 19:34

Note: if we want to use Emacs' default parser, the easiest format would be:

for ", line 12, char 34 to line 56, char 78"

Do we want to use this format, or do we think it's too unnatural for non-emacs users?

- Issue History
Date Modified Username Field Change
2010-06-13 19:45 palomer New Issue
2011-06-01 23:13 doligez Note Added: 0005957
2011-06-01 23:13 doligez Severity minor => feature
2011-06-01 23:13 doligez Status new => acknowledged
2012-02-13 18:01 doligez Relationship added related to 0004659
2012-02-14 10:16 gasche Relationship added related to 0005044
2012-08-08 16:53 doligez Note Added: 0007935
2012-08-08 16:53 doligez Note Edited: 0007935 View Revisions
2012-08-08 17:21 doligez Assigned To => doligez
2012-08-08 17:21 doligez Status acknowledged => assigned
2012-08-08 17:26 doligez Note Edited: 0007935 View Revisions
2014-08-29 14:29 doligez Relationship added has duplicate 0006518
2015-02-06 19:34 doligez Note Added: 0013245
2015-02-06 19:35 doligez Target Version => 4.03.0+dev

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker