]> git.eshelyaron.com Git - emacs.git/commitdiff
* Add 'native-comp-async-report-warnings-errors-kind'
authorAndrea Corallo <acorallo@gnu.org>
Thu, 29 Feb 2024 10:25:00 +0000 (11:25 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sat, 2 Mar 2024 06:30:32 +0000 (07:30 +0100)
* lisp/emacs-lisp/comp-run.el (native-comp-async-report-warnings-errors-kind):
Add new customize.

(cherry picked from commit 8e5baaddec2d6a7f48ca0a08e0a95a51c6cbb151)

lisp/emacs-lisp/comp-run.el

index c78b5ece9bd8b4a2affccb299093972b5e100203..eec50c39c6848ab1bb13130f3a5f6bfc656ab67c 100644 (file)
@@ -77,6 +77,19 @@ buffer."
           (const :tag "Report but do not display warnings/errors" silent))
   :version "28.1")
 
+(defcustom native-comp-async-report-warnings-errors-kind 'importants
+  "Select which kind of warnings and errors to report.
+
+Set this variable to `importants' to have only important warnings and
+all errors to be reported.
+
+Set this variable to `all' to have all warnings and errors to be
+reported."
+  :type '(choice
+          (const :tag "Report all warnings/errors" all)
+          (const :tag "Report only important warnings and errors" importants))
+  :version "30.1")
+
 (defcustom native-comp-always-compile nil
   "Non-nil means unconditionally (re-)compile all files."
   :type 'boolean
@@ -184,13 +197,21 @@ processes from `comp-async-compilations'"
       (let ((warning-suppress-types
              (if (eq native-comp-async-report-warnings-errors 'silent)
                  (cons '(comp) warning-suppress-types)
-               warning-suppress-types)))
+               warning-suppress-types))
+            (regexp (if (eq native-comp-async-report-warnings-errors-kind 'all)
+                        "^.*?\\(?:Error\\|Warning\\): .*$"
+                      (rx bol
+                          (*? nonl)
+                          (or
+                           (seq "Error: " (*? nonl))
+                           (seq "Warning: the function ‘" (1+ (not "’"))
+                                "’ is not known to be defined."))
+                          eol))))
         (with-current-buffer (process-buffer process)
           (save-excursion
             (accept-process-output process)
             (goto-char (or comp-last-scanned-async-output (point-min)))
-            (while (re-search-forward "^.*?\\(?:Error\\|Warning\\): .*$"
-                                      nil t)
+            (while (re-search-forward regexp nil t)
               (display-warning 'comp (match-string 0)))
             (setq comp-last-scanned-async-output (point-max)))))
     (accept-process-output process)))