Make | optional for 'gnu' regexp in compilation-mode (bug#80681)

* lisp/progmodes/compile.el
(compilation-error-regexp-alist-alist): Make leading '|'
optional when there are leading spaces (bug#80681).
* etc/compilation.txt (GNU style): New error with two leading
spaces.
* test/lisp/progmodes/compile-tests.el
(compile-test-error-regexps): Increment expected
compilation-num-errors-found.
(compile-tests--test-regexps-data): New error test case for
'gnu' with two leading spaces.  Change expected match for
'cucumber' to match again 'gnu'.

Copyright-paperwork-exempt: yes
This commit is contained in:
Toby Dylan Hocking
2026-03-26 08:51:27 -04:00
committed by Sean Whitton
parent 5045394694
commit eb4835e521
3 changed files with 9 additions and 4 deletions

View File

@@ -331,6 +331,7 @@ boost/container/detail/flat_tree.hpp:589:25: [ skipping 5 instantiation contex
|
|board.h:60:21:
| 60 | #define I(b, C) ((C).y * (b)->width + (C).x)
src/add.cpp:8:31: error: invalid operands of types const double and const double* to binary operator+
* Guile backtrace, 2.0.11

View File

@@ -460,8 +460,9 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
;; non-interactive programs other than compilers (e.g. the
;; "jade:" entry in compilation.txt).
(? (| (: alpha (+ (in ?. ?- alnum)) ":" (? " "))
;; Skip indentation generated by GCC's -fanalyzer.
(: (+ " ") "|")))
;; Skip indentation generated by GCC's -fanalyzer (with |),
;; or two spaces from pip install (without |).
(: (+ " ") (? "|"))))
;; File name group.
(group-n 1

View File

@@ -121,7 +121,8 @@
;; cucumber
(cucumber "Scenario: undefined step # features/cucumber.feature:3"
29 nil 3 "features/cucumber.feature" error)
(cucumber " /home/gusev/.rvm/foo/bar.rb:500:in `_wrap_assertion'"
;; Below is from cucumber but gnu regexp is consistent and matches first.
(gnu " /home/gusev/.rvm/foo/bar.rb:500:in `_wrap_assertion'"
1 nil 500 "/home/gusev/.rvm/foo/bar.rb" error)
;; edg-1 edg-2
(edg-1 "build/intel/debug/../../../struct.cpp(42): error: identifier \"foo\" is undefined"
@@ -271,6 +272,8 @@
1 nil 27041 "{standard input}" warning)
(gnu "boost/container/detail/flat_tree.hpp:589:25: [ skipping 5 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]"
1 25 589 "boost/container/detail/flat_tree.hpp" info)
;; Below from pip install, running g++ to compile python extension module.
(gnu " src/add.cpp:8:31: error: invalid operands of types const double and const double* to binary operator+" 1 31 8 "src/add.cpp" error)
;; Gradle/Kotlin
(gradle-kotlin
"e: file:///src/Test.kt:267:5 foo: bar" 4 5 267 "/src/Test.kt" error)
@@ -556,7 +559,7 @@ The test data is in `compile-tests--test-regexps-data'."
1 15 5 "alpha.c")))
(compile--test-error-line test))
(should (eq compilation-num-errors-found 110))
(should (eq compilation-num-errors-found 111))
(should (eq compilation-num-warnings-found 37))
(should (eq compilation-num-infos-found 36)))))