From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Jacques Le Normand <rathereasy@gmail.com>
Cc: 6416@debbugs.gnu.org
Subject: bug#6416: next-error mis-highlights ocaml error message locations
Date: Sun, 13 Jun 2010 18:46:25 -0400 [thread overview]
Message-ID: <jwvaaqyefi3.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <AANLkTinpFZGQkO9yLuLG8GMXVvP8Bo66Npcf5Ja197Al@mail.gmail.com> (Jacques Le Normand's message of "Sun, 13 Jun 2010 14:26:45 -0400")
> let foo : int =
> "foo"
> ^
> "bar"
> it gives me the error
> File "/home/palomer/temp/test.ml", line 2, characters 1-21:
> ...
> which refers to:
> "foo"
> ^
> "bar"
How does 1-21 refer to that, exactly? The first " seems to be either at
position 2 or 3 depending on whether you start counting at 0 or 1, so
how can it be 1-21 rather than 2-<something>?
Second, the 1-21 range refers to bytes in the file, right? (i.e. does
it count a TAB as 1 or as 8? how about a CR+LF?).
> next-error will try and highlight characters 1 to 21 on line 2. however,
> line 2 only contains 10 or so characters. This is because character 21
> actually refers to character 8 on line 4. Instead of highlighting 3 lines,
> only 1 line is highlighted.
Indeed, it's on purpose: I've never heard of a format of error messages
of a form like the one you describe, so compile.el makes no attempt to
handle such things, AFAIK. Usually error messages that can refer to
several lines take a form like "LINE.COL - LINE'.COL'" or something like
that where the end-line is specified explicitly.
So in the present case, compile.el guesses that the 21 is really an
error (maybe because it refers to some other version of the file or
something) and just stops the line's end. This behavior is The Right
Thing for most tools where such errors can never span multiple lines.
The questions above would help us figure out how to best adjust
compile.el and compilation-regexp-error-alist to handle such errors
correctly. Of course, the better solution would be to change OCaml so
as to use more standard error messages, such as the GNU format, so it
would "just work". So I suggest you also file a bug-report to the OCaml
guys that their error messages use a non-standard format and are
confusing since they only say "line 2, chars 1-21" even for a message
that spans lines 2-4.
Stefan
next prev parent reply other threads:[~2010-06-13 22:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-13 18:26 bug#6416: next-error mis-highlights ocaml error message locations Jacques Le Normand
2010-06-13 22:46 ` Stefan Monnier [this message]
2010-06-13 23:31 ` Jacques Le Normand
2010-06-14 13:23 ` Stefan Monnier
2021-08-26 18:30 ` Lars Ingebrigtsen
2021-09-23 21:55 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvaaqyefi3.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=6416@debbugs.gnu.org \
--cc=rathereasy@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.