unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Filipp Gunbin <fgunbin@fastmail.fm>
Cc: emacs-devel@gnu.org
Subject: Re: Review request: javac in compilation-error-regexp-alist-alist
Date: Wed, 1 Apr 2020 13:08:21 +0200	[thread overview]
Message-ID: <63D0E806-FB67-459E-BAE0-300C4EACEFA0@acm.org> (raw)
In-Reply-To: <m2y2rg59hx.fsf@fastmail.fm>

1 apr. 2020 kl. 02.34 skrev Filipp Gunbin <fgunbin@fastmail.fm>:

>> There seems to be an off-by-one error in the column number; try it and
>> you'll see. I think current-column is 0-based but Emacs expects a
>> 1-based column from the compilation error matcher.
> 
> I didn't notice this because I do (set (make-local-variable
> 'compilation-first-column) 0) in java-mode, but then other java rules
> (ant, maven) may also be buggy, I'll look at this in more detail.

(What java-mode are we talking about here? Some out-of-tree variant?)
There should be no need to set compilation-first-column since the rule does not match a column number directly but has to compute it using a function. In fact, if you remove the change to that variable, the function in the rule is neatly reduced from

  (lambda () (1- (current-column)))

to just

  #'current-column

This is also a benefit for other tools that use the same format, if any -- scalac maybe?

If you like, the same regexp in rx might be

(rx bol                              ; line 1
   (group-n 1 (? (in "A-Za-z") ":")  ; file
              (+ (not (in "\n:"))))
   ":"
   (group-n 2 (+ digit))             ; line
   ": "
   (? (group-n 3 "warning: "))       ; optional warning type
   (* nonl) "\n"                     ; message
   (* nonl) "\n"                     ; line 2: source line
   (* " ") "^" eol)                  ; line 3: Single ^ under error position

Here group-n has been used to make the group numbering stand out for extra clarity.




      reply	other threads:[~2020-04-01 11:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 18:17 Review request: javac in compilation-error-regexp-alist-alist Filipp Gunbin
2020-02-28 17:11 ` Mattias Engdegård
2020-02-28 23:02   ` Filipp Gunbin
2020-02-29 10:58     ` Mattias Engdegård
2020-04-01  0:34       ` Filipp Gunbin
2020-04-01 11:08         ` Mattias Engdegård [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63D0E806-FB67-459E-BAE0-300C4EACEFA0@acm.org \
    --to=mattiase@acm.org \
    --cc=emacs-devel@gnu.org \
    --cc=fgunbin@fastmail.fm \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).