aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Engdegård2023-02-06 11:45:33 +0100
committerMattias Engdegård2023-02-06 17:47:00 +0100
commit321cbd9a6014bf0b70dc0b01aed27f36aec4051d (patch)
treea3914e745bb9617a91461250cd21d292bcfddd45
parent97533e73ad68f8d9050f8ed349cf95f009e20b72 (diff)
downloademacs-321cbd9a6014bf0b70dc0b01aed27f36aec4051d.tar.gz
emacs-321cbd9a6014bf0b70dc0b01aed27f36aec4051d.zip
Tighten and simplify typescript compilation-mode regexps (bug#61104)
* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist): Tighten regexps and simplify. Translate to rx. * etc/compilation.txt: Add examples. In collaboration with Jostein Kjønigsen.
-rw-r--r--etc/compilation.txt14
-rw-r--r--lisp/progmodes/compile.el28
2 files changed, 34 insertions, 8 deletions
diff --git a/etc/compilation.txt b/etc/compilation.txt
index 672cbebafff..5f6ecb09cc2 100644
--- a/etc/compilation.txt
+++ b/etc/compilation.txt
@@ -639,6 +639,20 @@ symbol: weblint
639index.html (13:1) Unknown element <fdjsk> 639index.html (13:1) Unknown element <fdjsk>
640 640
641 641
642* Typescript prior to tsc version 2.7, "plain" format
643
644symbol: typescript-tsc-plain
645
646greeter.ts(30,12): error TS2339: Property 'foo' does not exist.
647
648
649* Typescript after tsc version 2.7, "pretty" format
650
651symbol: typescript-tsc-pretty
652
653src/resources/document.ts:140:22 - error TS2362: something.
654
655
642* Directory tracking 656* Directory tracking
643 657
644Directories are matched via 'compilation-directory-matcher'. Files which are 658Directories are matched via 'compilation-directory-matcher'. Files which are
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 1e57d0b7bb2..ccf64fb670b 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -653,19 +653,31 @@ File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = \\([0-9]+\\)\\)?"
653 ;; Typescript compilation prior to tsc version 2.7, "plain" format: 653 ;; Typescript compilation prior to tsc version 2.7, "plain" format:
654 ;; greeter.ts(30,12): error TS2339: Property 'foo' does not exist. 654 ;; greeter.ts(30,12): error TS2339: Property 'foo' does not exist.
655 (typescript-tsc-plain 655 (typescript-tsc-plain
656 ,(concat 656 ,(rx bol
657 "^[[:blank:]]*" 657 (group (not (in " \t\n()")) ; 1: file
658 "\\([^(\r\n)]+\\)(\\([0-9]+\\),\\([0-9]+\\)):[[:blank:]]+" 658 (* (not (in "\n()"))))
659 "error [[:alnum:]]+: [^\r\n]+$") 659 "("
660 (group (+ (in "0-9"))) ; 2: line
661 ","
662 (group (+ (in "0-9"))) ; 3: column
663 "): error "
664 (+ (in "0-9A-Z")) ; error code
665 ": ")
660 1 2 3 2) 666 1 2 3 2)
661 667
662 ;; Typescript compilation after tsc version 2.7, "pretty" format: 668 ;; Typescript compilation after tsc version 2.7, "pretty" format:
663 ;; src/resources/document.ts:140:22 - error TS2362: something. 669 ;; src/resources/document.ts:140:22 - error TS2362: something.
664 (typescript-tsc-pretty 670 (typescript-tsc-pretty
665 ,(concat 671 ,(rx bol
666 "^[[:blank:]]*" 672 (group (not (in " \t\n()")) ; 1: file
667 "\\([^(\r\n)]+\\):\\([0-9]+\\):\\([0-9]+\\) - [[:blank:]]*" 673 (* (not (in "\n()"))))
668 "error [[:alnum:]]+: [^\r\n]+$") 674 ":"
675 (group (+ (in "0-9"))) ; 2: line
676 ":"
677 (group (+ (in "0-9"))) ; 3: column
678 " - error "
679 (+ (in "0-9A-Z")) ; error code
680 ": ")
669 1 2 3 2) 681 1 2 3 2)
670 )) 682 ))
671 "Alist of values for `compilation-error-regexp-alist'.") 683 "Alist of values for `compilation-error-regexp-alist'.")