GNU bug report logs - #70794
30.0.50; Add Rust compilation regex

Previous Next

Package: emacs;

Reported by: Ergus <spacibba <at> aol.com>

Date: Mon, 6 May 2024 01:31:01 UTC

Severity: normal

Found in version 30.0.50

Done: Mattias EngdegÄrd <mattias.engdegard <at> gmail.com>

Full log


Message #76 received at 70794 <at> debbugs.gnu.org (full text, mbox):

From: Mattias EngdegÄrd <mattias.engdegard <at> gmail.com>
To: Vincenzo Pupillo <v.pupillo <at> gmail.com>
Cc: Randy Taylor <dev <at> rjt.dev>, spacibba <at> aol.com, bug-gnu-emacs <at> gnu.org,
 Stefan Kangas <stefankangas <at> gmail.com>, 70794 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#70794: 30.0.50; Add Rust compilation regex
Date: Thu, 15 May 2025 20:42:42 +0200
28 apr. 2025 kl. 22.22 skrev Vincenzo Pupillo <v.pupillo <at> gmail.com>:

> diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
> index 1ca58b3ac7d..7a1b5d4fdd1 100644
> --- a/lisp/progmodes/compile.el
> +++ b/lisp/progmodes/compile.el
> @@ -565,6 +565,13 @@ compilation-error-regexp-alist-alist
>       "\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)"
>       2 3 nil nil)
>  
> +    (rustc-error

Can't you combine the error and warning patterns into a single rule? It's what we normally try to do, and it doesn't make much sense having one without the other. The rust-mode code seems to indicate that there are info-level messages (using 'note:') so let's include those as well.

> +     "^error[^:]*:[^\n]*\n\s+-->\s\\([^\n]+\\):\\([0-9]+\\):\\([0-9]+\\)"

"[^\n]" is usually written as "." (in rx it's `not-newline` or `nonl`).

As mentioned before, the "[^:]*" matches way too much.

It seems that the number of spaces before the arrow is hard-coded to 2 in the output.

The "[^\n]+" for matching the file name will match all the way to the end, then backtrack several times to the first colon. But maybe you wrote it that way for Windows file names containing a drive letter? In that case we have little choice.

What about the following then:

 (rx bol (or "error" (group-n 1 "warning") (group-n 2 "note"))
     (? "[" (+ (in "A-Z" "0-9")) "]") ":" (* nonl)
     "\n  --> " (group-n 3 (+ nonl))   ; file
     ":" (group-n 4 (+ (in "0-9")))    ; line
     ":" (group-n 5 (+ (in "0-9"))))   ; column

If you like this, then please also include an example for 'note' messages, and add one to the tests.





This bug report was last modified 23 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.