unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* native-comp *Warnings* buffer
@ 2021-05-13 19:59 Eric Abrahamsen
  2021-05-13 20:20 ` Eric Abrahamsen
  2021-05-14  6:11 ` Eli Zaretskii
  0 siblings, 2 replies; 24+ messages in thread
From: Eric Abrahamsen @ 2021-05-13 19:59 UTC (permalink / raw)
  To: emacs-devel

I understand the utility of having these warnings, but does the buffer
need to be popped up every thirty seconds? Couldn't it just be displayed
once, when it's created, and then left alone? Compilation has been going
on for several minutes since rebuilding Emacs, and it's actually hard to
use with *Warnings* occupying my other window every few seconds!

Thanks,
Eric




^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  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-14  6:11 ` Eli Zaretskii
  1 sibling, 1 reply; 24+ messages in thread
From: Eric Abrahamsen @ 2021-05-13 20:20 UTC (permalink / raw)
  To: emacs-devel

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> I understand the utility of having these warnings, but does the buffer
> need to be popped up every thirty seconds? Couldn't it just be displayed
> once, when it's created, and then left alone? Compilation has been going
> on for several minutes since rebuilding Emacs, and it's actually hard to
> use with *Warnings* occupying my other window every few seconds!

I should say that I know about
`native-comp-async-report-warnings-errors', and I'd actually like to see
these warnings (as many of them are about my own code :(), I'd just like
to have them in the background.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  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-14  2:30     ` T.V Raman
  0 siblings, 2 replies; 24+ messages in thread
From: Andrea Corallo via Emacs development discussions. @ 2021-05-13 21:28 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: emacs-devel

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> I understand the utility of having these warnings, but does the buffer
>> need to be popped up every thirty seconds? Couldn't it just be displayed
>> once, when it's created, and then left alone? Compilation has been going
>> on for several minutes since rebuilding Emacs, and it's actually hard to
>> use with *Warnings* occupying my other window every few seconds!
>
> I should say that I know about
> `native-comp-async-report-warnings-errors', and I'd actually like to see
> these warnings (as many of them are about my own code :(), I'd just like
> to have them in the background.

Hi Eric,

unfortunately new warnings are showed when they are found while
compiling.  I agree this is annoying but at the same time I'm not sure
this behavior wrong.

Anyway in comp.el we just call `display-warning'.  If there's a better
way to handle this any suggestion or patch is very welcome :)

Thanks

  Andrea



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  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
  1 sibling, 2 replies; 24+ messages in thread
From: Eric Abrahamsen @ 2021-05-13 21:34 UTC (permalink / raw)
  To: Andrea Corallo via Emacs development discussions.; +Cc: Andrea Corallo

Andrea Corallo via "Emacs development discussions."
<emacs-devel@gnu.org> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>
>>> I understand the utility of having these warnings, but does the buffer
>>> need to be popped up every thirty seconds? Couldn't it just be displayed
>>> once, when it's created, and then left alone? Compilation has been going
>>> on for several minutes since rebuilding Emacs, and it's actually hard to
>>> use with *Warnings* occupying my other window every few seconds!
>>
>> I should say that I know about
>> `native-comp-async-report-warnings-errors', and I'd actually like to see
>> these warnings (as many of them are about my own code :(), I'd just like
>> to have them in the background.
>
> Hi Eric,
>
> unfortunately new warnings are showed when they are found while
> compiling.  I agree this is annoying but at the same time I'm not sure
> this behavior wrong.
>
> Anyway in comp.el we just call `display-warning'.  If there's a better
> way to handle this any suggestion or patch is very welcome :)

It looks like `warning-suppress-types' might do it!

List of warning types not to display immediately.
If any element of this list matches the TYPE argument to ‘display-warning’,
the warning is logged nonetheless, but the warnings buffer is
not immediately displayed.
The element must match an initial segment of the list TYPE.
Thus, (foo bar) as an element matches (foo bar)
or (foo bar ANYTHING...) as TYPE.
If TYPE is a symbol FOO, that is equivalent to the list (FOO),
so only the element (FOO) will match it.

Let-binding this with 'comp in the value should do it.

We could add 'suppress or 'quiet as an alternate value
`native-comp-async-report-warnings-errors', and use that to optionally
change the value of `warning-suppress-types'.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-13 21:34     ` Eric Abrahamsen
@ 2021-05-13 22:00       ` Eric Abrahamsen
  2021-05-14  6:28       ` Eli Zaretskii
  1 sibling, 0 replies; 24+ messages in thread
From: Eric Abrahamsen @ 2021-05-13 22:00 UTC (permalink / raw)
  To: Andrea Corallo via Emacs development discussions.; +Cc: Andrea Corallo

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Andrea Corallo via "Emacs development discussions."
> <emacs-devel@gnu.org> writes:
>
>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>
>>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>>
>>>> I understand the utility of having these warnings, but does the buffer
>>>> need to be popped up every thirty seconds? Couldn't it just be displayed
>>>> once, when it's created, and then left alone? Compilation has been going
>>>> on for several minutes since rebuilding Emacs, and it's actually hard to
>>>> use with *Warnings* occupying my other window every few seconds!
>>>
>>> I should say that I know about
>>> `native-comp-async-report-warnings-errors', and I'd actually like to see
>>> these warnings (as many of them are about my own code :(), I'd just like
>>> to have them in the background.
>>
>> Hi Eric,
>>
>> unfortunately new warnings are showed when they are found while
>> compiling.  I agree this is annoying but at the same time I'm not sure
>> this behavior wrong.
>>
>> Anyway in comp.el we just call `display-warning'.  If there's a better
>> way to handle this any suggestion or patch is very welcome :)
>
> It looks like `warning-suppress-types' might do it!
>
> List of warning types not to display immediately.
> If any element of this list matches the TYPE argument to ‘display-warning’,
> the warning is logged nonetheless, but the warnings buffer is
> not immediately displayed.
> The element must match an initial segment of the list TYPE.
> Thus, (foo bar) as an element matches (foo bar)
> or (foo bar ANYTHING...) as TYPE.
> If TYPE is a symbol FOO, that is equivalent to the list (FOO),
> so only the element (FOO) will match it.
>
> Let-binding this with 'comp in the value should do it.
>
> We could add 'suppress or 'quiet as an alternate value
> `native-comp-async-report-warnings-errors', and use that to optionally
> change the value of `warning-suppress-types'.

Well I guess I could have figured this out myself: the clickable
"Disable showing" button at the end of every warning does exactly this:
customizes `warning-suppress-types' so that the '(comp) warnings are
still logged to *Warnings*, but it doesn't pop up the buffer. This seems
like enough customization to me, and there's no need to add any code!

Actually it looks like `native-comp-async-report-warnings-errors' could
be replaced by customization of `warning-suppress-log-types', which will
prevent logging altogether. Anyway, problem solved!



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-13 21:28   ` Andrea Corallo via Emacs development discussions.
  2021-05-13 21:34     ` Eric Abrahamsen
@ 2021-05-14  2:30     ` T.V Raman
  2021-05-14  6:42       ` Eli Zaretskii
  1 sibling, 1 reply; 24+ messages in thread
From: T.V Raman @ 2021-05-14  2:30 UTC (permalink / raw)
  To: Andrea Corallo via Emacs development discussions.
  Cc: Eric Abrahamsen, Andrea Corallo

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 1762 bytes --]

Andrea Corallo via "Emacs development discussions."
<emacs-devel@gnu.org> writes:


Lacking a better solution, I implemented myself an after advice on
display-warning that buries the buffer and produces a soft sound to let
me know that a warning got added; then I just go visit that buffer when
I have some cycles to see what raised the warning, and whether it is in
my code, how to fix it etc.

One issue with the warnings is that the reported line  that triggered
the warning tends to  be one or two indirections removed (eg via require
 etc) which makes finding the actual cause fairly  difficult for now > Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>
>>> I understand the utility of having these warnings, but does the buffer
>>> need to be popped up every thirty seconds? Couldn't it just be displayed
>>> once, when it's created, and then left alone? Compilation has been going
>>> on for several minutes since rebuilding Emacs, and it's actually hard to
>>> use with *Warnings* occupying my other window every few seconds!
>>
>> I should say that I know about
>> `native-comp-async-report-warnings-errors', and I'd actually like to see
>> these warnings (as many of them are about my own code :(), I'd just like
>> to have them in the background.
>
> Hi Eric,
>
> unfortunately new warnings are showed when they are found while
> compiling.  I agree this is annoying but at the same time I'm not sure
> this behavior wrong.
>
> Anyway in comp.el we just call `display-warning'.  If there's a better
> way to handle this any suggestion or patch is very welcome :)
>
> Thanks
>
>   Andrea
>

-- 

Thanks,

--Raman
7©4 Id: kg:/m/0285kf1  •0Ü8



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-13 19:59 native-comp *Warnings* buffer Eric Abrahamsen
  2021-05-13 20:20 ` Eric Abrahamsen
@ 2021-05-14  6:11 ` Eli Zaretskii
  2021-05-14 15:44   ` Eric Abrahamsen
  1 sibling, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2021-05-14  6:11 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: emacs-devel

> From: Eric Abrahamsen <eric@ericabrahamsen.net>
> Date: Thu, 13 May 2021 12:59:12 -0700
> 
> I understand the utility of having these warnings, but does the buffer
> need to be popped up every thirty seconds?

It only pops up if you delete the window, doesn't it?  So in what
sense is it different from what we do with the *Compilation* buffer?



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-13 21:34     ` Eric Abrahamsen
  2021-05-13 22:00       ` Eric Abrahamsen
@ 2021-05-14  6:28       ` Eli Zaretskii
  1 sibling, 0 replies; 24+ messages in thread
From: Eli Zaretskii @ 2021-05-14  6:28 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: akrl, emacs-devel

> From: Eric Abrahamsen <eric@ericabrahamsen.net>
> Date: Thu, 13 May 2021 14:34:40 -0700
> Cc: Andrea Corallo <akrl@sdf.org>
> 
> We could add 'suppress or 'quiet as an alternate value
> `native-comp-async-report-warnings-errors', and use that to optionally
> change the value of `warning-suppress-types'.

Yes, this could be a good feature, for those who want this deferral up
front, not via the buttons already present.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-14  2:30     ` T.V Raman
@ 2021-05-14  6:42       ` Eli Zaretskii
  0 siblings, 0 replies; 24+ messages in thread
From: Eli Zaretskii @ 2021-05-14  6:42 UTC (permalink / raw)
  To: T.V Raman; +Cc: eric, akrl, emacs-devel

> From: "T.V Raman" <raman@google.com>
> Cc: Eric Abrahamsen <eric@ericabrahamsen.net>,  Andrea Corallo <akrl@sdf.org>
> Date: Thu, 13 May 2021 19:30:17 -0700
> 
> Lacking a better solution, I implemented myself an after advice on
> display-warning that buries the buffer and produces a soft sound to let
> me know that a warning got added; then I just go visit that buffer when
> I have some cycles to see what raised the warning, and whether it is in
> my code, how to fix it etc.

May I suggest that you report these issues instead of (or in addition
to) working around them in your Emacs?  Especially when these problems
are from a development version, we need help from everyone who uses
that version to stabilize it as quickly as possible.  We cannot do
that efficiently if people solve the issues privately without telling
us.

TIA.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-14  6:11 ` Eli Zaretskii
@ 2021-05-14 15:44   ` Eric Abrahamsen
  2021-05-14 16:23     ` Stefan Monnier
  0 siblings, 1 reply; 24+ messages in thread
From: Eric Abrahamsen @ 2021-05-14 15:44 UTC (permalink / raw)
  To: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Eric Abrahamsen <eric@ericabrahamsen.net>
>> Date: Thu, 13 May 2021 12:59:12 -0700
>> 
>> I understand the utility of having these warnings, but does the buffer
>> need to be popped up every thirty seconds?
>
> It only pops up if you delete the window, doesn't it?  So in what
> sense is it different from what we do with the *Compilation* buffer?

I guess usage. I only see the *Compilation* buffer when I've
done something to ask for it (updating packages, etc), and it's over
relatively quickly. These warnings went on for many long minutes, at
random intervals. I was trying to work in two side-by-side buffers, and
it kept stealing the other one -- I even switched frames once the
*Warnings* buffer was open, but it followed me to the new frame.

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Eric Abrahamsen <eric@ericabrahamsen.net>
>> Date: Thu, 13 May 2021 14:34:40 -0700
>> Cc: Andrea Corallo <akrl@sdf.org>
>> 
>> We could add 'suppress or 'quiet as an alternate value
>> `native-comp-async-report-warnings-errors', and use that to optionally
>> change the value of `warning-suppress-types'.
>
> Yes, this could be a good feature, for those who want this deferral up
> front, not via the buttons already present.

I could do a patch for that, but the existing mechanisms *are* pretty
thorough: big prominent buttons that do exactly what they promise to do
(I'm a bit embarrassed I didn't just read the instructions).




^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-14 15:44   ` Eric Abrahamsen
@ 2021-05-14 16:23     ` Stefan Monnier
  2021-05-14 16:46       ` Eric Abrahamsen
  2021-05-15  5:33       ` Richard Stallman
  0 siblings, 2 replies; 24+ messages in thread
From: Stefan Monnier @ 2021-05-14 16:23 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: emacs-devel

> I guess usage. I only see the *Compilation* buffer when I've
> done something to ask for it (updating packages, etc), and it's over
> relatively quickly. These warnings went on for many long minutes, at
> random intervals. I was trying to work in two side-by-side buffers, and
> it kept stealing the other one -- I even switched frames once the
> *Warnings* buffer was open, but it followed me to the new frame.

I think "stealth" compilation performed opportunistically in the
background should indeed not display any warnings (by default).

> I could do a patch for that, but the existing mechanisms *are* pretty
> thorough: big prominent buttons that do exactly what they promise to do
> (I'm a bit embarrassed I didn't just read the instructions).

Don't those buttons also suppress the warnings for the normal
(non-async, non-native) compilation case?  If so, we should be careful
not to encourage the users to do that when they're only annoyed by the
async warnings.


        Stefan




^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  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
  1 sibling, 1 reply; 24+ messages in thread
From: Eric Abrahamsen @ 2021-05-14 16:46 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel



On May 14, 2021 9:23:50 AM PDT, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> I guess usage. I only see the *Compilation* buffer when I've
>> done something to ask for it (updating packages, etc), and it's over
>> relatively quickly. These warnings went on for many long minutes, at
>> random intervals. I was trying to work in two side-by-side buffers,
>and
>> it kept stealing the other one -- I even switched frames once the
>> *Warnings* buffer was open, but it followed me to the new frame.
>
>I think "stealth" compilation performed opportunistically in the
>background should indeed not display any warnings (by default).
>
>> I could do a patch for that, but the existing mechanisms *are* pretty
>> thorough: big prominent buttons that do exactly what they promise to
>do
>> (I'm a bit embarrassed I didn't just read the instructions).
>
>Don't those buttons also suppress the warnings for the normal
>(non-async, non-native) compilation case?  If so, we should be careful
>not to encourage the users to do that when they're only annoyed by the
>async warnings.

The buttons will add '(comp) to the list of suppressed warnings, so no warnings with that tag would ever be popped-up, in any context. I'm not sure what else uses that tag (I'm on my phone right now) but yes, that might be a little drastic.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-14 16:46       ` Eric Abrahamsen
@ 2021-05-14 16:54         ` Eric Abrahamsen
  0 siblings, 0 replies; 24+ messages in thread
From: Eric Abrahamsen @ 2021-05-14 16:54 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel



On May 14, 2021 9:46:41 AM PDT, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
>
>
>On May 14, 2021 9:23:50 AM PDT, Stefan Monnier
><monnier@iro.umontreal.ca> wrote:
>>> I guess usage. I only see the *Compilation* buffer when I've
>>> done something to ask for it (updating packages, etc), and it's over
>>> relatively quickly. These warnings went on for many long minutes, at
>>> random intervals. I was trying to work in two side-by-side buffers,
>>and
>>> it kept stealing the other one -- I even switched frames once the
>>> *Warnings* buffer was open, but it followed me to the new frame.
>>
>>I think "stealth" compilation performed opportunistically in the
>>background should indeed not display any warnings (by default).
>>
>>> I could do a patch for that, but the existing mechanisms *are*
>pretty
>>> thorough: big prominent buttons that do exactly what they promise to
>>do
>>> (I'm a bit embarrassed I didn't just read the instructions).
>>
>>Don't those buttons also suppress the warnings for the normal
>>(non-async, non-native) compilation case?  If so, we should be careful
>>not to encourage the users to do that when they're only annoyed by the
>>async warnings.
>
>The buttons will add '(comp) to the list of suppressed warnings, so no
>warnings with that tag would ever be popped-up, in any context. I'm not
>sure what else uses that tag (I'm on my phone right now) but yes, that
>might be a little drastic.

If anyone else does use 'comp, we could have comp.el use '(comp async), which seems nicely targeted.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-14 16:23     ` Stefan Monnier
  2021-05-14 16:46       ` Eric Abrahamsen
@ 2021-05-15  5:33       ` Richard Stallman
  2021-05-16  4:15         ` Eric Abrahamsen
  2021-05-16  5:12         ` Stefan Monnier
  1 sibling, 2 replies; 24+ messages in thread
From: Richard Stallman @ 2021-05-15  5:33 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: eric, emacs-devel

[[[ 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?

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-15  5:33       ` Richard Stallman
@ 2021-05-16  4:15         ` Eric Abrahamsen
  2021-05-16 14:06           ` Jump to source of warning was " T.V Raman
                             ` (2 more replies)
  2021-05-16  5:12         ` Stefan Monnier
  1 sibling, 3 replies; 24+ messages in thread
From: Eric Abrahamsen @ 2021-05-16  4:15 UTC (permalink / raw)
  To: Richard Stallman; +Cc: Stefan Monnier, emacs-devel

[-- 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


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-15  5:33       ` Richard Stallman
  2021-05-16  4:15         ` Eric Abrahamsen
@ 2021-05-16  5:12         ` Stefan Monnier
  2021-05-16  5:30           ` Eli Zaretskii
  1 sibling, 1 reply; 24+ messages in thread
From: Stefan Monnier @ 2021-05-16  5:12 UTC (permalink / raw)
  To: Richard Stallman; +Cc: eric, emacs-devel

>   > 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 material won't happen later?

No, the compilation must have happened *before*, because native
compilation is only performed for files that are compiled to
`.elc`, AFAIK.

> Is there a chance that you'll never see the warnings that
> compilation generates?

AFAIK, no, because before native compilation takes place, the code will
already have been byte-compiled.


        Stefan




^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-16  5:12         ` Stefan Monnier
@ 2021-05-16  5:30           ` Eli Zaretskii
  2021-05-16  6:03             ` Stefan Monnier
  0 siblings, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2021-05-16  5:30 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: eric, rms, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: eric@ericabrahamsen.net,  emacs-devel@gnu.org
> Date: Sun, 16 May 2021 01:12:49 -0400
> 
> >   > 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 material won't happen later?
> 
> No, the compilation must have happened *before*, because native
> compilation is only performed for files that are compiled to
> `.elc`, AFAIK.
> 
> > Is there a chance that you'll never see the warnings that
> > compilation generates?
> 
> AFAIK, no, because before native compilation takes place, the code will
> already have been byte-compiled.

I think it actually could happen if the relevant *.el files are
modified during the session and then recompiled or reloaded.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-16  5:30           ` Eli Zaretskii
@ 2021-05-16  6:03             ` Stefan Monnier
  0 siblings, 0 replies; 24+ messages in thread
From: Stefan Monnier @ 2021-05-16  6:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rms, eric, emacs-devel

>> AFAIK, no, because before native compilation takes place, the code will
>> already have been byte-compiled.
> I think it actually could happen if the relevant *.el files are
> modified during the session and then recompiled or reloaded.

If so, we'll need to address that, indeed.

But currently, the warnings we get from async native compilation are
both annoying and redundant in almost all cases, so I think that
silencing them is a good "first cut".
[ Tho I don't mind keeping them enabled for now on `master`: it only
  needs to be fixed "some time" before the release and I don't think
  there's a particular hurry.  ]


        Stefan




^ permalink raw reply	[flat|nested] 24+ messages in thread

* Jump to source of warning was  Re: native-comp *Warnings* buffer
  2021-05-16  4:15         ` Eric Abrahamsen
@ 2021-05-16 14:06           ` T.V Raman
  2021-05-16 20:04           ` Andrea Corallo via Emacs development discussions.
  2021-05-17  3:23           ` Richard Stallman
  2 siblings, 0 replies; 24+ messages in thread
From: T.V Raman @ 2021-05-16 14:06 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: Stefan Monnier, emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 1383 bytes --]

Eric Abrahamsen <eric@ericabrahamsen.net> writes:


Re the Warnings buffer, would it be possible to add a button that jumps
to the place in the elisp source that produced the warning?

> 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.
>
>

-- 

Thanks,

--Raman
7©4 Id: kg:/m/0285kf1  •0Ü8



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-16  4:15         ` Eric Abrahamsen
  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  3:23           ` Richard Stallman
  2 siblings, 1 reply; 24+ messages in thread
From: Andrea Corallo via Emacs development discussions. @ 2021-05-16 20:04 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: Richard Stallman, Stefan Monnier, emacs-devel

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> 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.

Hi Eric,

thanks for the patch, it sounds like a good idea.

Just a small nit below otherwise LGTM.

>>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*
              ^^^
              `silent'?
> +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")

[...]

Thanks

  Andrea



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  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.
  0 siblings, 1 reply; 24+ messages in thread
From: Eric Abrahamsen @ 2021-05-16 21:25 UTC (permalink / raw)
  To: Andrea Corallo via Emacs development discussions.
  Cc: Richard Stallman, Stefan Monnier, Andrea Corallo

Andrea Corallo via "Emacs development discussions."
<emacs-devel@gnu.org> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> 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.
>
> Hi Eric,
>
> thanks for the patch, it sounds like a good idea.
>
> Just a small nit below otherwise LGTM.
>
>>>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*
>               ^^^
>               `silent'?

Whoops! I went back and forth on the symbol to use, and apparently
settled on "borth". Thanks.

I forgot to say, I only put this check on one of the three
`display-warning' call-sites in this file, because the others looked
like fairly specific situations that the user should be bothered about.
If they should all have it, I can do that, too.

Eric



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-16  4:15         ` Eric Abrahamsen
  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-17  3:23           ` Richard Stallman
  2021-05-17  6:16             ` Eli Zaretskii
  2 siblings, 1 reply; 24+ messages in thread
From: Richard Stallman @ 2021-05-17  3:23 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: monnier, emacs-devel

[[[ 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. ]]]

  > 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.

Yes, that's exactly the issue.

If you were going to have a compilation of foo.el based on some
explicit request, and therefore see its warnings then,
anything that compiles it by anticipation
and does not show you its warnings
could cause that explicit request NOT to compile it
(because it was compiled recently), and therefore you
would never see its warnings.

Most of the time this would not matter at all.
However, on rare occasions it could cause a real problem.
Perhaps even a serious one.

So I think it is important to make sure this scenario -- suppressing
a warning you would have been shown -- cannot happen.

There are many ways to do that.  My concern is simply that it be done,
one way or another.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-16 21:25             ` Eric Abrahamsen
@ 2021-05-17  6:11               ` Andrea Corallo via Emacs development discussions.
  0 siblings, 0 replies; 24+ messages in thread
From: Andrea Corallo via Emacs development discussions. @ 2021-05-17  6:11 UTC (permalink / raw)
  To: Eric Abrahamsen
  Cc: Andrea Corallo via Emacs development discussions.,
	Richard Stallman, Stefan Monnier

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> I forgot to say, I only put this check on one of the three
> `display-warning' call-sites in this file, because the others looked
> like fairly specific situations that the user should be bothered about.
> If they should all have it, I can do that, too.
>
> Eric

I agree with you that's the only place I'd gate `display-warning' in
comp.el for now.

  Andrea



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: native-comp *Warnings* buffer
  2021-05-17  3:23           ` Richard Stallman
@ 2021-05-17  6:16             ` Eli Zaretskii
  0 siblings, 0 replies; 24+ messages in thread
From: Eli Zaretskii @ 2021-05-17  6:16 UTC (permalink / raw)
  To: rms; +Cc: eric, monnier, emacs-devel

> From: Richard Stallman <rms@gnu.org>
> Date: Sun, 16 May 2021 23:23:34 -0400
> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
> 
> If you were going to have a compilation of foo.el based on some
> explicit request, and therefore see its warnings then,
> anything that compiles it by anticipation
> and does not show you its warnings
> could cause that explicit request NOT to compile it
> (because it was compiled recently), and therefore you
> would never see its warnings.

I don't think I understand the scenario you described.  Could you
perhaps describe it in simpler terms, like

  . user does A
  . Emacs does X and shows Y
  . user does B
  . emacs shows Z

etc.?

I'm asking because I'd like to figure out what we currently do in this
situation, and how this discussion could affect that.

Thanks.



^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2021-05-17  6:16 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).