unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: Richard Stallman <rms@gnu.org>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: native-comp *Warnings* buffer
Date: Sat, 15 May 2021 21:15:26 -0700	[thread overview]
Message-ID: <87y2cfwbz5.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <E1lhmvK-0002rs-Ir@fencepost.gnu.org> (Richard Stallman's message of "Sat, 15 May 2021 01:33:14 -0400")

[-- Attachment #1: Type: text/plain, Size: 1071 bytes --]

Richard Stallman <rms@gnu.org> writes:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > I think "stealth" compilation performed opportunistically in the
>   > background should indeed not display any warnings (by default).
>
> I understand the reason for saying that, but... would this mean that a
> compilation of that meaterial won't happen later?  Is there a chance
> that you'll never see the warnings that compilation generates?

This wouldn't affect the actual compilation at all. It could affect
whether the user sees the warnings or not, if we default to not popping
up the *Warnings* buffer. They might still go looking for the buffer, or
stumble upon it by accident, though.

I've attached a patch that provides a 'silent option to
`native-comp-async-report-warnings-errors'. In this patch the default is
still t, though we could easily default to 'silent if that seems
desirable.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Provide-a-silent-option-for-native-comp-asyncreport-.patch --]
[-- Type: text/x-patch, Size: 2788 bytes --]

From 01516b21e71862f3496e3a1f75bb86d436afaa3b Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@ericabrahamsen.net>
Date: Sat, 15 May 2021 09:36:05 -0700
Subject: [PATCH] Provide a 'silent option for
 native-comp-asyncreport-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 3e7f17ef1c..8fa9dee1ed 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -148,8 +148,13 @@ native-comp-async-report-warnings-errors
 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 `quiet' 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 @@ comp-last-scanned-async-output
 (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 ()
-- 
2.31.1


  reply	other threads:[~2021-05-16  4:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13 19:59 native-comp *Warnings* buffer Eric Abrahamsen
2021-05-13 20:20 ` Eric Abrahamsen
2021-05-13 21:28   ` Andrea Corallo via Emacs development discussions.
2021-05-13 21:34     ` Eric Abrahamsen
2021-05-13 22:00       ` Eric Abrahamsen
2021-05-14  6:28       ` Eli Zaretskii
2021-05-14  2:30     ` T.V Raman
2021-05-14  6:42       ` Eli Zaretskii
2021-05-14  6:11 ` Eli Zaretskii
2021-05-14 15:44   ` Eric Abrahamsen
2021-05-14 16:23     ` Stefan Monnier
2021-05-14 16:46       ` Eric Abrahamsen
2021-05-14 16:54         ` Eric Abrahamsen
2021-05-15  5:33       ` Richard Stallman
2021-05-16  4:15         ` Eric Abrahamsen [this message]
2021-05-16 14:06           ` Jump to source of warning was " T.V Raman
2021-05-16 20:04           ` Andrea Corallo via Emacs development discussions.
2021-05-16 21:25             ` Eric Abrahamsen
2021-05-17  6:11               ` Andrea Corallo via Emacs development discussions.
2021-05-17  3:23           ` Richard Stallman
2021-05-17  6:16             ` Eli Zaretskii
2021-05-16  5:12         ` Stefan Monnier
2021-05-16  5:30           ` Eli Zaretskii
2021-05-16  6:03             ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2cfwbz5.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).