unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 30757@debbugs.gnu.org
Subject: bug#30757: Better manipulation (suppressing, examining type) of warnings from *Warnings* buffer
Date: Fri, 09 Mar 2018 15:11:22 +0100	[thread overview]
Message-ID: <871sgtnxth.fsf@gmail.com> (raw)
In-Reply-To: <877eql1ld0.fsf@gmail.com> (Noam Postavsky's message of "Fri, 09 Mar 2018 07:31:23 -0500")

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

Noam Postavsky <npostavs@gmail.com> writes:

> Severity: wishlist
>
> It would be nice if warnings in the *Warnings* buffer came with some
> kind of button to let the user add the relevant value to
> warning-suppress-types or warning-suppress-log-types.

Adjust strings according to your personal preference. The button names
are a tad verbose as well :-)


[-- Attachment #2: Type: text/plain, Size: 1460 bytes --]

diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 489611d4d1..0e31511287 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -197,6 +197,18 @@ warning-suppress-p
     ;; we return t.
     some-match))
 \f
+
+(define-button-type 'warning-suppress-warning
+  'action #'warning-suppress-action
+  'help-echo "mouse-2, RET: Suppress showing this warning")
+(defun warning-suppress-action (button)
+  (add-to-list 'warning-suppress-types (list (button-get button 'warning-type))))
+(define-button-type 'warning-suppress-log-warning
+  'action #'warning-suppress-log-action
+  'help-echo "mouse-2, RET: Never log this warning")
+(defun warning-suppress-log-action (button)
+  (add-to-list 'warning-suppress-log-types (list (button-get button 'warning-type))))
+
 ;;;###autoload
 (defun display-warning (type message &optional level buffer-name)
   "Display a warning message, MESSAGE.
@@ -264,6 +276,10 @@ display-warning
 	      (insert (format (nth 1 level-info)
 			      (format warning-type-format typename))
 		      message)
+              (insert " ")
+              (insert-button "Suppress" 'type 'warning-suppress-warning 'warning-type type)
+              (insert " ")
+              (insert-button "Never Log" 'type 'warning-suppress-log-warning 'warning-type type)
 	      (newline)
 	      (when (and warning-fill-prefix (not (string-match "\n" message)))
 		(let ((fill-prefix warning-fill-prefix)

  reply	other threads:[~2018-03-09 14:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-09 12:31 bug#30757: Better manipulation (suppressing, examining type) of warnings from *Warnings* buffer Noam Postavsky
2018-03-09 14:11 ` Robert Pluim [this message]
2018-03-09 14:24   ` Robert Pluim
2018-03-09 14:53     ` Noam Postavsky
2018-03-09 15:53       ` Robert Pluim
2018-03-09 16:18         ` Eli Zaretskii
2018-03-09 16:54           ` Robert Pluim
2018-03-09 18:28             ` Eli Zaretskii
2018-03-10  3:14             ` Noam Postavsky
2018-03-12 11:04               ` Robert Pluim
2020-09-04  4:30             ` Lars Ingebrigtsen
2020-09-04  8:54               ` Robert Pluim
2020-09-04 11:22                 ` Lars Ingebrigtsen
2018-03-09 15:05 ` Drew Adams
2018-03-09 15:49   ` Robert Pluim

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=871sgtnxth.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=30757@debbugs.gnu.org \
    --cc=npostavs@gmail.com \
    /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).