More robust `gnu` pattern (bug#56249)
authorMattias Engdegård <mattiase@acm.org>
Wed, 29 Jun 2022 15:18:04 +0000 (17:18 +0200)
committerMattias Engdegård <mattiase@acm.org>
Wed, 29 Jun 2022 15:28:24 +0000 (17:28 +0200)
* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Don't allow spaces in the file names, to avoid false matches.
Don't allow ad-hoc spaces preceding the program name either.

lisp/progmodes/compile.el

index 3393aa9b635413552bf64693f472f277c1bf304f..db57093559d076b808da1dc1a57efab98244621e 100644 (file)
@@ -368,17 +368,18 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
        ;; Match an optional program name which is used for
        ;; non-interactive programs other than compilers (e.g. the
        ;; "jade:" entry in compilation.txt).
-       (? (: (* " ")        ; Allow space to precede the program name.
-             (| (: alpha (+ (in ?. ?- alnum)) ":" (? " "))
-                ;; Skip indentation generated by GCC's -fanalyzer.
-                (: (+ " ") "|"))))
+       (? (| (: alpha (+ (in ?. ?- alnum)) ":" (? " "))
+             ;; Skip indentation generated by GCC's -fanalyzer.
+             (: (+ " ") "|")))
 
        ;; File name group.
        (group-n 1
          ;; Avoid matching the file name as a program in the pattern
          ;; above by disallowing file names entirely composed of digits.
-         (* (in "0-9"))
-         (not (in "0-9" "\n"))
+         ;; Do not allow file names beginning with a space.
+         (| (not (in "0-9" "\n\t "))
+            (: (+ (in "0-9"))
+               (not (in "0-9" "\n"))))
          ;; A file name can be composed of any non-newline char, but
          ;; rule out some valid but unlikely cases, such as a trailing
          ;; space or a space followed by a -, or a colon followed by a