emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Review request: javac in compilation-error-regexp-alist-alist


From: Mattias Engdegård
Subject: Re: Review request: javac in compilation-error-regexp-alist-alist
Date: Wed, 1 Apr 2020 13:08:21 +0200

1 apr. 2020 kl. 02.34 skrev Filipp Gunbin <address@hidden>:

>> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]