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: Fri, 28 Feb 2020 18:11:21 +0100 [thread overview]
Message-ID: <81FF6512-6E29-46F7-9AAD-324D915B3F2F@acm.org> (raw)
In-Reply-To: <m2blpjzyhq.fsf@fastmail.fm>
27 feb. 2020 kl. 19.17 skrev Filipp Gunbin <fgunbin@fastmail.fm>:
> Besides that, `java' symbol in the said list is a misnomer: it handles
> java exceptions (why? we would never normally have them in the
> compilation output), and valgrind output. Looks like we should just
> rename it to `valgrind'.
Maybe, but as you can see there are several questionably-named entries in the list. Renaming them may break user customisation.
As it is, it would be useful with a comment explaining the difference between 'java' and 'javac' in the list.
> + (javac
> + ,(concat
> + ;; line1
> + "^\\(\\(?:[A-Za-z]:\\)?[^:\n]+\\): *" ;file
> + "\\([0-9]+\\): *" ;line
> + "\\(?:error:\\|\\(warning\\):\\)?[^\n]*\n" ;type (optional) and message
> + ;; line2: source line containing error
> + "[^\n]*\n"
> + ;; line3: single "^" under error position in line2
> + "[[:space:]]*\\^\n")
(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.)
Regexps in this list are good to keep tight; don't cast a net wider than you have to. For instance, don't use " *" unless you know that there may actually be any number of spaces. Most regexps here don't match; optimise for that, rejecting false attempts as early as possible. Be stingy.
There's an unnecessary ambiguity after the line number and colon; a string of spaces can match in multiple ways. Also, avoid [[:space:]] since you don't control that syntax class in the buffer; more likely it should just be plain spaces, as it's very unlikely that the javac caret output routine would use anything else.
> + 1 2
> + (lambda ()
If you add a comma before the lambda-expression, it gets evaluated, byte-compiled, syntax-checked etc.
> + ("/src/Test.java:5: ';' expected\n foo foo\n ^\n" 1 15 5 "/src/Test.java" 2)
> + ("e:\\src\\Test.java: 7: warning: ';' expected\n foo foo\n ^\n" 1 10 7 "e:\\src\\Test.java" 1)
Why the differences in spacing before the line number? Is it a difference between platforms, error/warning, javac versions, or just different compilers altogether? Comments explaining this would be useful. Be sure to include variants in compilation.txt.
next prev parent reply other threads:[~2020-02-28 17:11 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 [this message]
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
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=81FF6512-6E29-46F7-9AAD-324D915B3F2F@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).