emacs-diffs
[Top][All Lists]
Advanced

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

master e761e12: Add a 'silent option for native-comp-async-report-warnin


From: Eric Abrahamsen
Subject: master e761e12: Add a 'silent option for native-comp-async-report-warnings-errors
Date: Sun, 16 May 2021 17:28:21 -0400 (EDT)

branch: master
commit e761e12498ff108c3b82e9d27843baec6670447c
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    Add a 'silent option for native-comp-async-report-warnings-errors
    
    * lisp/emacs-lisp/comp.el (native-comp-async-report-warnings-errors):
    Set to 'silent to log warnings, but not pop up the *Warnings* buffer.
    * lisp/emacs-lisp/comp.el (comp-accept-and-process-async-output):
    Check value.
---
 lisp/emacs-lisp/comp.el | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 3e7f17e..8c63831 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -148,8 +148,13 @@ As asynchronous native compilation always starts from a 
pristine
 environment, it is more sensitive to such omissions, and might be
 unable to compile such Lisp source files correctly.
 
-Set this variable to nil if these warnings annoy you."
-  :type 'boolean
+Set this variable to nil to suppress warnings altogether, or to
+the symbol `silent' to log warnings but not pop up the *Warnings*
+buffer."
+  :type '(choice
+          (const :tag "Do not report warnings" nil)
+          (const :tag "Report and display warnings" t)
+          (const :tag "Report but do not display warnings" 'silent))
   :version "28.1")
 
 (defcustom native-comp-async-query-on-exit nil
@@ -3874,14 +3879,18 @@ processes from `comp-async-compilations'"
 (defun comp-accept-and-process-async-output (process)
   "Accept PROCESS output and check for diagnostic messages."
   (if native-comp-async-report-warnings-errors
-      (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)
-            (display-warning 'comp (match-string 0)))
-          (setq comp-last-scanned-async-output (point-max))))
+      (let ((warning-suppress-types
+             (if (eq native-comp-async-report-warnings-errors 'silent)
+                 (cons '(comp) warning-suppress-types)
+               warning-suppress-types)))
+        (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)
+              (display-warning 'comp (match-string 0)))
+            (setq comp-last-scanned-async-output (point-max)))))
     (accept-process-output process)))
 
 (defun comp-run-async-workers ()



reply via email to

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