all messages for Emacs-related lists mirrored at yhetil.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: Sat, 29 Feb 2020 11:58:05 +0100	[thread overview]
Message-ID: <DA121AEE-FC96-4816-8A80-15BDE1E16930@acm.org> (raw)
In-Reply-To: <m2pndyz56e.fsf@fastmail.fm>

29 feb. 2020 kl. 00.02 skrev Filipp Gunbin <fgunbin@fastmail.fm>:

>> (Could I entice you into writing this regexp in rx? Not mandatory in
>> any way, but at least some of us who read it will thank you.)
> 
> I'm not experienced with it yet, but noted, will do later.

It's entirely optional. You could try the 'xr' package to help you translate.

> +    (javac
> +     ,(concat
> +       ;; line1
> +       "^\\(\\(?:[A-Za-z]:\\)?[^:\n]+\\):" ;file
> +       "\\([0-9]+\\): "                    ;line
> +       "\\(?:\\(?:error\\|\\(warning\\)\\): \\)?[^\n]*\n" ;type (optional) and message

Thank you, much better. You may want to use '.' instead of '[^\n]'; they mean exactly the same thing.
There is also no need to match "error" specifically; "\\(warning: \\)?" suffices.

> +       ;; line2: source line containing error
> +       "[^\n]*\n"
> +       ;; line3: single "^" under error position in line2
> +       " *\\^\n")
> +     1 2
> +     ,(lambda ()
> +        (save-excursion
> +          (backward-char 2)             ; move back over "^\n"
> +          (current-column)))

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.

A minor bug (probably in compilation-mode) is that the mouse highlighting includes the first character of the line following the caret line. To avoid this, try replacing the final '\n' with '$'. As an extra benefit, the need for save-excursion and backward-char would go away.

This rule does present some performance concerns (perhaps unfounded): the first line, the "file:line: message" part, is likely to match many non-java messages. The entire next line is then matched regardless of contents, and the missing caret finally causes backtracking. I'm not sure how serious this is, or what can be done about it.




  reply	other threads:[~2020-02-29 10:58 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 [this message]
2020-04-01  0:34       ` Filipp Gunbin
2020-04-01 11:08         ` Mattias Engdegård

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=DA121AEE-FC96-4816-8A80-15BDE1E16930@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 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.