From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jacques Le Normand Newsgroups: gmane.emacs.bugs Subject: bug#6416: next-error mis-highlights ocaml error message locations Date: Sun, 13 Jun 2010 19:31:53 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016367fb3e3f3f5390488f1c6a0 X-Trace: dough.gmane.org 1276473527 9368 80.91.229.12 (13 Jun 2010 23:58:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 13 Jun 2010 23:58:47 +0000 (UTC) Cc: 6416@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 14 01:58:41 2010 connect(): No such file or directory Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ONx4V-0002PT-CR for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Jun 2010 01:58:35 +0200 Original-Received: from localhost ([127.0.0.1]:33652 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ONx4U-00038L-Pr for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 Jun 2010 19:58:34 -0400 Original-Received: from [140.186.70.92] (port=60891 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ONx4O-00037o-Ia for bug-gnu-emacs@gnu.org; Sun, 13 Jun 2010 19:58:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ONx4N-0008Bv-7D for bug-gnu-emacs@gnu.org; Sun, 13 Jun 2010 19:58:28 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34872) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ONx4N-0008Br-3D for bug-gnu-emacs@gnu.org; Sun, 13 Jun 2010 19:58:27 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1ONweo-0000Z9-Gy; Sun, 13 Jun 2010 19:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jacques Le Normand Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Jun 2010 23:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6416 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6416-submit@debbugs.gnu.org id=B6416.12764719222172 (code B ref 6416); Sun, 13 Jun 2010 23:32:02 +0000 Original-Received: (at 6416) by debbugs.gnu.org; 13 Jun 2010 23:32:02 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ONwen-0000Yv-FF for submit@debbugs.gnu.org; Sun, 13 Jun 2010 19:32:01 -0400 Original-Received: from mail-wy0-f172.google.com ([74.125.82.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ONwek-0000Yq-IX for 6416@debbugs.gnu.org; Sun, 13 Jun 2010 19:32:00 -0400 Original-Received: by wyi11 with SMTP id 11so2522371wyi.3 for <6416@debbugs.gnu.org>; Sun, 13 Jun 2010 16:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=rucorTfx749uDvUONmjIjwmj4CrpM7tJ5SDlQ7RTBqQ=; b=t6NyD6/7K7smsWqY6LwdAbyuK/IU7jzfSxJIUhy0NYKYY1fheJtAikybH0wGAYBQC6 YzAf39RSWQWIbPW5CQCmnOHmN0c++iouy0tL6Ptf76xPRlp2/c62vaBgGTOO/0mX2Wtr ep35oHZggY/i6RV7nsiD1ssRRD8i/wLhioMes= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=evKex9qEdRWT6iL0uEuk0lLhetgBl4QxlsiZnoUxRJthVTJRRU9CeHEJalmg+FxdDf ztacU6cC9kqimGBLSmU9x5vHA/T82/G1f3sXPvY/4kossxcuJzjLImB8hhD8kEyU1CQX 0I8A/fL3AYFTMLYGNaUhqgq2fp9/pHAiy81sk= Original-Received: by 10.216.187.149 with SMTP id y21mr1598136wem.37.1276471913214; Sun, 13 Jun 2010 16:31:53 -0700 (PDT) Original-Received: by 10.216.52.145 with HTTP; Sun, 13 Jun 2010 16:31:53 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 13 Jun 2010 19:32:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:37759 Archived-At: --0016367fb3e3f3f5390488f1c6a0 Content-Type: text/plain; charset=ISO-8859-1 I apologize, the numbers in the example were erroneous. Take this example instead: let foo: int = "foo" ^ "bar" gives the error: File "/home/palomer/temp/test.ml", line 2, characters 2-21: ocamlc starts counting at 0. it counts newlines and tabs as 1. I obtained these results empirically. The previous example means: "the third character from the start of line 2 to the 22nd character from the start of line 2" I've filed a bug report with ocaml developers (and have even suggested a simple fix.) I can't say how inclined they will be to fix it. The bug id is 0005070. The mantis url is http://caml.inria.fr/mantis/ thank you for your quick response, -- Jacques On Sun, Jun 13, 2010 at 6:46 PM, Stefan Monnier wrote: > > 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-? > > 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 > --0016367fb3e3f3f5390488f1c6a0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I apologize, the numbers in the example were erroneous. Take this exam= ple instead:

let foo: int =3D=A0
= =A0=A0"foo"
=A0=A0^
=A0=A0 =A0"bar"=

gives the error:
File "/home/palomer/temp/test.ml", line 2, characters 2-21:

ocamlc starts counting at 0. it counts newlines and tabs as 1. I= obtained these results empirically. =A0The previous example means:
"the third character from the start of line 2 to the 22nd charact= er from the start of line 2"

I've filed a= bug report with ocaml developers (and have even suggested a simple fix.) I= can't say how inclined they will be to fix it. The bug id is=A00005070= . The mantis url is http://caml.in= ria.fr/mantis/

thank you for your quick response,
-- Jacques=

On Sun, Jun 13, 2010 at 6:46 PM, = Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> let foo : int =3D
> =A0 "foo"
> =A0 ^
> =A0 =A0 "bar"

> it gives me the error

> File "/home/palomer/temp/test.ml", line 2, characters 1-21:
> ...

> which refers to:
> =A0 "foo"
> =A0 ^
> =A0 =A0 "bar"

How does 1-21 refer to that, exactly? =A0The first " seems to be eithe= r 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? =A0(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. howeve= r,
> 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 li= nes,
> only 1 line is highlighted.

Indeed, it's on purpose: I've never heard of a format of error mess= ages
of a form like the one you describe, so compile.el makes no attempt to
handle such things, AFAIK. =A0Usually 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. =A0This 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. =A0Of 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". =A0So 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 mes= sage
that spans lines 2-4.


=A0 =A0 =A0 =A0Stefan

--0016367fb3e3f3f5390488f1c6a0--