I am running Emacs 28.2. After I recently upgraded from Emacs 27, I started to get a lot of false matches in the compilation buffer. (They may have been there before, but I had to remove my customization of compilation-error-regexp-alist
to get true errors to be matched.)
When I run a mvn
build with M-x compile
, lines like these from the logger are matching as errors:
11:17:46.123 [main] INFO c.e.m.SomeClass - Some log message
The 11 and 17 are underlined and a different color. If I do C-h k <left-click>
on that line, the help text indicates that <mouse-2> (translated from <mouse-1>
runs compile-goto-error
.
Since much of my compile buffer is log statements of this format, this means that click in the compilation buffer frequently brings up a dialog, asking me where the source for the file from this "error" is.
I tried to customize compilation-error-regexp-alist
to remove a bunch of options that I don't use, but the error is still there.
Is there a good way to indicate that this format is not an error? Or to easily figure out which symbol is causing the problem? I've looked at compilation-error-regexp-alist-alist
, and while I can read regex, that's a lot of complicated expressions.
I do have a lot of customizations, but when I started emacs with emacs -Q
, the same thing happened.
The problem is definitely in the timestamp: I see the same behavior if my compile command is echo '12:34:56.789'
UPDATE
mvn
isn't in the alist-alist, but maven
is:
(insert (format "\n%s\n" (assq 'mvn compilation-error-regexp-alist-alist)))
nil
(insert (format "\n%s\n" (assq 'maven compilation-error-regexp-alist-alist)))
(maven ^\(?:\[\(?:ERROR\|\(?1:WARNING\)\|\(?2:INFO\)\)] \)?\(?3:[^
[]\(?:[^
:]\| [^
/-]\|:[^
[]\)*\):\[\(?4:[[:digit:]]+\),\(?5:[[:digit:]]+\)] 3 4 5 (1 . 2))
Is there magic where compilation-mode
reads the command and then only uses a subset of the alists? If there is, what variables control that. My actual compile command is mvnFind.sh ...
where mvnFind.sh
walks up the directory tree until it finds a pom.xml, then invokes mvn
from that directory. This lets me do M-x compile
from a Java buffer and not need to open the pom or do directory gymnastics in the command.
Changing compilation-error-regexp-alist
to '(maven)
did fix the problem, although it does mean that compiling other languages (or probably even the project that uses grade) will lead to unrecognized real errors.
compilation-error-regexp-alist-alist
, just the one that corresponds to your language. What does(assq 'mvn compilation-error-regexp-alist-alist)
return? Best to edit your question and add that. BTW, for me that returnsnil
and that may be the problem you are running into, but you should take that with a large grain of salt. – NickD May 11 '23 at 16:19