emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ca9f0e75b1f: Omit the `omake` compilation-mode rule by default


From: Mattias Engdegård
Subject: master ca9f0e75b1f: Omit the `omake` compilation-mode rule by default
Date: Thu, 5 Oct 2023 07:23:43 -0400 (EDT)

branch: master
commit ca9f0e75b1f25b02b32538246ea64e50be6c97c0
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    Omit the `omake` compilation-mode rule by default
    
    It keeps interfering with other rules, slowing everything down a
    little bit and makes it harder to add or change other rules.  The rule
    is still there and can easily be re-enabled by those who need it.
    
    * etc/NEWS: Announce.
    * lisp/progmodes/compile.el (compilation-error-regexp-alist):
    Exclude `omake`.
    * test/lisp/progmodes/compile-tests.el
    (compile-tests--test-regexps-data):
    Actually test the `cucumber` rule. Remove the `omake` test case.
    (compile-test-error-regexps):
    Test `omake` here.  Test other rules without `omake` included.
---
 etc/NEWS                             |  8 ++++++++
 lisp/progmodes/compile.el            |  5 ++++-
 test/lisp/progmodes/compile-tests.el | 26 +++++++++++++++++---------
 3 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index b3c7d3a8693..12c2d52a4ab 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -299,6 +299,14 @@ equivalent to the "--heading" option of some tools such as 
'git grep'
 and 'rg'.  The headings are displayed using the new 'grep-heading'
 face.
 
+---
+** Compilation mode
+
+*** The 'omake' matching rule is now disabled by default.
+This is because it partly acts by modifying other rules which may
+occasionally be surprising.  It can be re-enabled by adding 'omake' to
+'compilation-error-regexp-alist'.
+
 ** VC
 
 ---
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 4cf62476148..9e441dbfcf7 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -683,7 +683,10 @@ File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = 
\\([0-9]+\\)\\)?"
   "Alist of values for `compilation-error-regexp-alist'.")
 
 (defcustom compilation-error-regexp-alist
-  (mapcar #'car compilation-error-regexp-alist-alist)
+  ;; Omit `omake' by default: its mere presence here triggers special 
processing
+  ;; and modifies regexps for other rules (see `compilation-parse-errors'),
+  ;; which may slow down matching (or even cause mismatches).
+  (delq 'omake (mapcar #'car compilation-error-regexp-alist-alist))
   "Alist that specifies how to match errors in compiler output.
 On GNU and Unix, any string is a valid filename, so these
 matchers must make some common sense assumptions, which catch
diff --git a/test/lisp/progmodes/compile-tests.el 
b/test/lisp/progmodes/compile-tests.el
index 078eef36774..d497644c389 100644
--- a/test/lisp/progmodes/compile-tests.el
+++ b/test/lisp/progmodes/compile-tests.el
@@ -121,9 +121,7 @@
     ;; cucumber
     (cucumber "Scenario: undefined step  # features/cucumber.feature:3"
      29 nil 3 "features/cucumber.feature")
-    ;; This rule is actually handled by the `cucumber' pattern but when
-    ;; `omake' is included, then `gnu' matches it first.
-    (gnu "      /home/gusev/.rvm/foo/bar.rb:500:in `_wrap_assertion'"
+    (cucumber "      /home/gusev/.rvm/foo/bar.rb:500:in `_wrap_assertion'"
      1 nil 500 "/home/gusev/.rvm/foo/bar.rb")
     ;; edg-1 edg-2
     (edg-1 "build/intel/debug/../../../struct.cpp(42): error: identifier 
\"foo\" is undefined"
@@ -312,10 +310,6 @@
      1 nil 109 "..\\src\\ctrl\\lister.c")
     (watcom "..\\src\\ctrl\\lister.c(120): Warning! W201: Unreachable code"
      1 nil 120 "..\\src\\ctrl\\lister.c")
-    ;; omake
-    ;; FIXME: This doesn't actually test the omake rule.
-    (gnu "      alpha.c:5:15: error: expected ';' after expression"
-     1 15 5 "alpha.c")
     ;; oracle
     (oracle "Semantic error at line 528, column 5, file erosacqdb.pc:"
      1 5 528 "erosacqdb.pc")
@@ -497,8 +491,22 @@ The test data is in `compile-tests--test-regexps-data'."
     (font-lock-mode -1)
     (let ((compilation-num-errors-found 0)
           (compilation-num-warnings-found 0)
-          (compilation-num-infos-found 0))
-      (mapc #'compile--test-error-line compile-tests--test-regexps-data)
+          (compilation-num-infos-found 0)
+          (all-rules (mapcar #'car compilation-error-regexp-alist-alist)))
+
+      ;; Test all built-in rules except `omake' to avoid interference.
+      (let ((compilation-error-regexp-alist (remq 'omake all-rules)))
+        (mapc #'compile--test-error-line compile-tests--test-regexps-data))
+
+      ;; Test the `omake' rule separately.
+      ;; This doesn't actually test the `omake' rule itself but its
+      ;; indirect effects.
+      (let ((compilation-error-regexp-alist all-rules)
+            (test
+             '(gnu "      alpha.c:5:15: error: expected ';' after expression"
+                   1 15 5 "alpha.c")))
+        (compile--test-error-line test))
+
       (should (eq compilation-num-errors-found 100))
       (should (eq compilation-num-warnings-found 35))
       (should (eq compilation-num-infos-found 28)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]