unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43467: 28.0.50; [PATCH] defcustom warning-show-suppression-buttons
@ 2020-09-17 15:52 No Wayman
  2020-09-17 16:04 ` bug#43467: [PATCH] defcustom warning-show-suppression-buttons correction No Wayman
  0 siblings, 1 reply; 9+ messages in thread
From: No Wayman @ 2020-09-17 15:52 UTC (permalink / raw)
  To: 43467

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

User-agent: mu4e 1.5.5; emacs 28.0.50
User-agent: mu4e 1.5.5; emacs 28.0.50
BCC: No Wayman <iarchivedmywholelife@gmail.com>

The new warning suppression button behavior introduced in 
66d01012ba61a364fe92cdc1728bfa135a90626a
is a great idea, but I don't have much use for it and would prefer 
to not have the buttons clutter
the *Warnings* buffer.

The attached patch introduces a defcustom to control the display 
of the buttons.

Thanks,

Nicholas Vollmer


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: defcustom-warning-show-suppression-buttons --]
[-- Type: text/x-patch, Size: 1560 bytes --]

From 74b2cce64bb0a1c6a65749b055078e5b1c326160 Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
Date: Thu, 17 Sep 2020 11:40:41 -0400
Subject: [PATCH] Allow customization of warning suppression button display

* lisp/emacs-lisp/warnings.el (warning-show-suppression-buttons):
new defcustom to disable/enable display of warning suppression buttons
in *Warnings* buffer.
---
 lisp/emacs-lisp/warnings.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index e10c149d89..35e9870d1a 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -116,6 +116,11 @@ warning-suppress-types
 See also `warning-suppress-log-types'."
   :type '(repeat (repeat symbol))
   :version "22.1")
+
+(defcustom warning-show-suppression-buttons t
+  "Whether or not to show suppresion buttons in the *Warnings* buffer.
+If t, buttons are shown, else they are not."
+  :type 'boolean)
 \f
 ;; The autoload cookie is so that programs can bind this variable
 ;; safely, testing the existing value, before they call one of the
@@ -294,7 +299,7 @@ display-warning
 		      message)
               ;; Don't output the buttons when doing batch compilation
               ;; and similar.
-              (unless noninteractive
+              (unless (or noninteractive warning-show-suppression-buttons)
                 (insert " ")
                 (insert-button "Disable showing"
                                'type 'warning-suppress-warning
-- 
2.28.0


[-- Attachment #3: Type: text/plain, Size: 38 bytes --]

Date: Thu, 17 Sep 2020 11:52:04 -0400

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

* bug#43467: [PATCH] defcustom warning-show-suppression-buttons correction
  2020-09-17 15:52 bug#43467: 28.0.50; [PATCH] defcustom warning-show-suppression-buttons No Wayman
@ 2020-09-17 16:04 ` No Wayman
  2020-09-17 16:13   ` Robert Pluim
  2020-09-17 16:16   ` Lars Ingebrigtsen
  0 siblings, 2 replies; 9+ messages in thread
From: No Wayman @ 2020-09-17 16:04 UTC (permalink / raw)
  To: 43467

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


Sorry, just woke up. The attached patch corrects the logic of the 
first one.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: warning-show-suppression-buttons-correction --]
[-- Type: text/x-patch, Size: 1566 bytes --]

From 0f5caefcfe496ebccfedf24cfc75b249e1e7bf76 Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
Date: Thu, 17 Sep 2020 11:40:41 -0400
Subject: [PATCH] Allow customization of warning suppression button display

* lisp/emacs-lisp/warnings.el (warning-show-suppression-buttons):
new defcustom to disable/enable display of warning suppression buttons
in *Warnings* buffer.
---
 lisp/emacs-lisp/warnings.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index e10c149d89..8ed4e425f3 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -116,6 +116,11 @@ warning-suppress-types
 See also `warning-suppress-log-types'."
   :type '(repeat (repeat symbol))
   :version "22.1")
+
+(defcustom warning-show-suppression-buttons t
+  "Whether or not to show suppresion buttons in the *Warnings* buffer.
+If t, buttons are shown, else they are not."
+  :type 'boolean)
 \f
 ;; The autoload cookie is so that programs can bind this variable
 ;; safely, testing the existing value, before they call one of the
@@ -294,7 +299,7 @@ display-warning
 		      message)
               ;; Don't output the buttons when doing batch compilation
               ;; and similar.
-              (unless noninteractive
+              (unless (or noninteractive (not warning-show-suppression-buttons))
                 (insert " ")
                 (insert-button "Disable showing"
                                'type 'warning-suppress-warning
-- 
2.28.0


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

* bug#43467: [PATCH] defcustom warning-show-suppression-buttons correction
  2020-09-17 16:04 ` bug#43467: [PATCH] defcustom warning-show-suppression-buttons correction No Wayman
@ 2020-09-17 16:13   ` Robert Pluim
  2020-09-17 16:24     ` No Wayman
  2020-09-17 16:16   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 9+ messages in thread
From: Robert Pluim @ 2020-09-17 16:13 UTC (permalink / raw)
  To: No Wayman; +Cc: 43467

>>>>> On Thu, 17 Sep 2020 12:04:20 -0400, No Wayman <iarchivedmywholelife@gmail.com> said:

    No> Sorry, just woke up. The attached patch corrects the logic of the
    No> first one.

    No> From 0f5caefcfe496ebccfedf24cfc75b249e1e7bf76 Mon Sep 17 00:00:00 2001
    No> From: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
    No> Date: Thu, 17 Sep 2020 11:40:41 -0400
    No> Subject: [PATCH] Allow customization of warning suppression button display

    No> * lisp/emacs-lisp/warnings.el (warning-show-suppression-buttons):
    No> new defcustom to disable/enable display of warning suppression buttons
    No> in *Warnings* buffer.
    No> ---
    No>  lisp/emacs-lisp/warnings.el | 7 ++++++-
    No>  1 file changed, 6 insertions(+), 1 deletion(-)

    No> diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
    No> index e10c149d89..8ed4e425f3 100644
    No> --- a/lisp/emacs-lisp/warnings.el
    No> +++ b/lisp/emacs-lisp/warnings.el
    No> @@ -116,6 +116,11 @@ warning-suppress-types
    No>  See also `warning-suppress-log-types'."
    No>    :type '(repeat (repeat symbol))
    No>    :version "22.1")
    No> +
    No> +(defcustom warning-show-suppression-buttons t
    No> +  "Whether or not to show suppresion buttons in the *Warnings* buffer.
    No> +If t, buttons are shown, else they are not."
    No> +  :type 'boolean)

Your defcustom needs a :version "28.1"

Robert





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

* bug#43467: [PATCH] defcustom warning-show-suppression-buttons correction
  2020-09-17 16:04 ` bug#43467: [PATCH] defcustom warning-show-suppression-buttons correction No Wayman
  2020-09-17 16:13   ` Robert Pluim
@ 2020-09-17 16:16   ` Lars Ingebrigtsen
  2020-09-17 17:09     ` No Wayman
  1 sibling, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-17 16:16 UTC (permalink / raw)
  To: No Wayman; +Cc: 43467

No Wayman <iarchivedmywholelife@gmail.com> writes:

> * lisp/emacs-lisp/warnings.el (warning-show-suppression-buttons):
> new defcustom to disable/enable display of warning suppression buttons
> in *Warnings* buffer.

Warnings are something you should rarely get, so I'm not quite sure I
see the use case for this?  In any case, some minor comments...

> +(defcustom warning-show-suppression-buttons t
> +  "Whether or not to show suppresion buttons in the *Warnings* buffer.

                            suppression

> +If t, buttons are shown, else they are not."

We usually say "if non-nil", not "t".

> +  :type 'boolean)

And there should be a :version here.

> -              (unless noninteractive
> +              (unless (or noninteractive (not warning-show-suppression-buttons))

And perhaps this would be clearer as a (when (and .. instead.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#43467: [PATCH] defcustom warning-show-suppression-buttons correction
  2020-09-17 16:13   ` Robert Pluim
@ 2020-09-17 16:24     ` No Wayman
  0 siblings, 0 replies; 9+ messages in thread
From: No Wayman @ 2020-09-17 16:24 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 43467

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


Robert Pluim <rpluim@gmail.com> writes:
> Your defcustom needs a :version "28.1"

Thanks, Robert. Addressed in attached patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: take three --]
[-- Type: text/x-patch, Size: 1586 bytes --]

From 6160b555d4155141646c9064e59a41895c11e665 Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
Date: Thu, 17 Sep 2020 11:40:41 -0400
Subject: [PATCH] Allow customization of warning suppression button display

* lisp/emacs-lisp/warnings.el (warning-show-suppression-buttons):
new defcustom to disable/enable display of warning suppression buttons
in *Warnings* buffer.
---
 lisp/emacs-lisp/warnings.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index e10c149d89..5a8152d2dc 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -116,6 +116,12 @@ warning-suppress-types
 See also `warning-suppress-log-types'."
   :type '(repeat (repeat symbol))
   :version "22.1")
+
+(defcustom warning-show-suppression-buttons t
+  "Whether or not to show suppresion buttons in the *Warnings* buffer.
+If t, buttons are shown, else they are not."
+  :type 'boolean
+  :version "28.1")
 \f
 ;; The autoload cookie is so that programs can bind this variable
 ;; safely, testing the existing value, before they call one of the
@@ -294,7 +300,7 @@ display-warning
 		      message)
               ;; Don't output the buttons when doing batch compilation
               ;; and similar.
-              (unless noninteractive
+              (unless (or noninteractive (not warning-show-suppression-buttons))
                 (insert " ")
                 (insert-button "Disable showing"
                                'type 'warning-suppress-warning
-- 
2.28.0


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

* bug#43467: [PATCH] defcustom warning-show-suppression-buttons correction
  2020-09-17 16:16   ` Lars Ingebrigtsen
@ 2020-09-17 17:09     ` No Wayman
  2020-09-17 17:27       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: No Wayman @ 2020-09-17 17:09 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43467

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


Lars Ingebrigtsen <larsi@gnus.org> writes:

Thanks for the feedback, Lars.

> Warnings are something you should rarely get, so I'm not quite 
> sure I
> see the use case for this?  In any case, some minor comments...

The same argument could be made against the buttons/suppression 
themselves:

"Warnings are something you should rarely get, so I'm not quite 
sure I see the use case for suppressing them."

I don't see either as a particularly strong argument.
For me, the buttons are useless because I have `custom-file` set 
to `null-device'.
They just add visual clutter to the buffer in that case.
The customization seems pretty low-cost in terms of 
complexity/maintenance IMO and provides the flexibility
to accommodate my (and possibly other we haven't thought of) use 
cases.

> And perhaps this would be clearer as a (when (and .. instead.

Addressed by changing the customization to 
`warning-hide-suppression-buttons' and inverting the semantics in 
the attached patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: warning-hide-suppression-buttons --]
[-- Type: text/x-patch, Size: 1588 bytes --]

From 03035944c1f19bbb628c798ce1f6feeceedbc7b3 Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
Date: Thu, 17 Sep 2020 11:40:41 -0400
Subject: [PATCH] Allow customization of warning suppression button display

* lisp/emacs-lisp/warnings.el (warning-hide-suppression-buttons):
new defcustom to disable/enable display of warning suppression buttons
in *Warnings* buffer.
---
 lisp/emacs-lisp/warnings.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index e10c149d89..d7345b2536 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -116,6 +116,12 @@ warning-suppress-types
 See also `warning-suppress-log-types'."
   :type '(repeat (repeat symbol))
   :version "22.1")
+
+(defcustom warning-hide-suppression-buttons nil
+  "Whether or not to hide suppression buttons in the *Warnings* buffer.
+If non-nil, buttons are hidden, else they shown."
+  :type 'boolean
+  :version "28.1")
 \f
 ;; The autoload cookie is so that programs can bind this variable
 ;; safely, testing the existing value, before they call one of the
@@ -294,7 +300,7 @@ display-warning
 		      message)
               ;; Don't output the buttons when doing batch compilation
               ;; and similar.
-              (unless noninteractive
+              (unless (or noninteractive warning-hide-suppression-buttons)
                 (insert " ")
                 (insert-button "Disable showing"
                                'type 'warning-suppress-warning
-- 
2.28.0


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

* bug#43467: [PATCH] defcustom warning-show-suppression-buttons correction
  2020-09-17 17:09     ` No Wayman
@ 2020-09-17 17:27       ` Lars Ingebrigtsen
  2020-09-17 18:08         ` No Wayman
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-17 17:27 UTC (permalink / raw)
  To: No Wayman; +Cc: 43467

No Wayman <iarchivedmywholelife@gmail.com> writes:

>> Warnings are something you should rarely get, so I'm not quite sure I
>> see the use case for this?  In any case, some minor comments...
>
> The same argument could be made against the buttons/suppression
> themselves:
>
> "Warnings are something you should rarely get, so I'm not quite sure I
> see the use case for suppressing them."

No, the opposite -- since you get the warnings so seldom, it makes sense
to have the very few you see come with ready-made ways of making them go
away, and then you're back to no warnings again.

> I don't see either as a particularly strong argument.
> For me, the buttons are useless because I have `custom-file` set to
> `null-device'.

I think that's a very unusual thing to do, so it doesn't seem much like
a use case.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#43467: [PATCH] defcustom warning-show-suppression-buttons correction
  2020-09-17 17:27       ` Lars Ingebrigtsen
@ 2020-09-17 18:08         ` No Wayman
  2020-09-18 13:14           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: No Wayman @ 2020-09-17 18:08 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43467


Lars Ingebrigtsen <larsi@gnus.org> writes:

> No Wayman <iarchivedmywholelife@gmail.com> writes:

> I think that's a very unusual thing to do, so it doesn't seem 
> much like
> a use case.

We don't see eye to eye on this, but fair enough.
I've offered the patch and my justification. I have nothing more 
to add.





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

* bug#43467: [PATCH] defcustom warning-show-suppression-buttons correction
  2020-09-17 18:08         ` No Wayman
@ 2020-09-18 13:14           ` Lars Ingebrigtsen
  0 siblings, 0 replies; 9+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-18 13:14 UTC (permalink / raw)
  To: No Wayman; +Cc: 43467

No Wayman <iarchivedmywholelife@gmail.com> writes:

> We don't see eye to eye on this, but fair enough.
> I've offered the patch and my justification. I have nothing more to
> add.

OK; then it seems unlikely that we'll make further progress in this bug
report, and I'm closing it.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2020-09-18 13:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-17 15:52 bug#43467: 28.0.50; [PATCH] defcustom warning-show-suppression-buttons No Wayman
2020-09-17 16:04 ` bug#43467: [PATCH] defcustom warning-show-suppression-buttons correction No Wayman
2020-09-17 16:13   ` Robert Pluim
2020-09-17 16:24     ` No Wayman
2020-09-17 16:16   ` Lars Ingebrigtsen
2020-09-17 17:09     ` No Wayman
2020-09-17 17:27       ` Lars Ingebrigtsen
2020-09-17 18:08         ` No Wayman
2020-09-18 13:14           ` Lars Ingebrigtsen

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