From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#30757: Better manipulation (suppressing, examining type) of warnings from *Warnings* buffer Date: Fri, 09 Mar 2018 17:54:23 +0100 Message-ID: <87vae5jikg.fsf@gmail.com> References: <877eql1ld0.fsf@gmail.com> <871sgtnxth.fsf@gmail.com> <87woylminv.fsf@gmail.com> <873719kzyh.fsf@gmail.com> <83zi3husrr.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1520615691 5810 195.159.176.226 (9 Mar 2018 17:14:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 9 Mar 2018 17:14:51 +0000 (UTC) Cc: 30757@debbugs.gnu.org, npostavs@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 09 18:14:47 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1euLbR-0001P1-E6 for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Mar 2018 18:14:45 +0100 Original-Received: from localhost ([::1]:46659 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1euLdU-0008Qb-50 for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Mar 2018 12:16:52 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1euLIQ-0006PI-2T for bug-gnu-emacs@gnu.org; Fri, 09 Mar 2018 11:55:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1euLIM-0006SA-3V for bug-gnu-emacs@gnu.org; Fri, 09 Mar 2018 11:55:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44831) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1euLIL-0006S1-VE for bug-gnu-emacs@gnu.org; Fri, 09 Mar 2018 11:55:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1euLIL-0003JE-Mw for bug-gnu-emacs@gnu.org; Fri, 09 Mar 2018 11:55:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Mar 2018 16:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30757 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 30757-submit@debbugs.gnu.org id=B30757.152061447412677 (code B ref 30757); Fri, 09 Mar 2018 16:55:01 +0000 Original-Received: (at 30757) by debbugs.gnu.org; 9 Mar 2018 16:54:34 +0000 Original-Received: from localhost ([127.0.0.1]:52728 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1euLHu-0003IP-6w for submit@debbugs.gnu.org; Fri, 09 Mar 2018 11:54:34 -0500 Original-Received: from mail-wr0-f193.google.com ([209.85.128.193]:38467) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1euLHr-0003I9-D1 for 30757@debbugs.gnu.org; Fri, 09 Mar 2018 11:54:33 -0500 Original-Received: by mail-wr0-f193.google.com with SMTP id n7so9647737wrn.5 for <30757@debbugs.gnu.org>; Fri, 09 Mar 2018 08:54:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-copies-to:gmane-reply-to-list :date:in-reply-to:message-id:mime-version; bh=TiFEFDNoYtk9t6k5QWRwz20HX5DaJlFc2a+ZZbPMUjw=; b=OaZxU4pciWMmpkovzQYpvu0bZmIL5mtvcDvZG1cKyvGc5xNTsrdC17ZhP4vA8K5F4h +QdMBIFUA8vNjjgHZb8f/fu1uzj0wXJ2NcGrcGO4mw8yLPgDbv54IIRwV70pVxGtblFr 5Eph0nxMMx7/2evigJugg4BrmGCeQ/VMw+ELbGM/LwwPpY4QEZ9+YpbQzHsN2xrZxrxG 2n/YBwoDXGRUEmQPZWuOKNd9UV8sG28Al40Y4LCATFw48MRbh/VTsLzZMzeIssnm/CdV gCLMhNmcnsSD8to+HAeNQGgLM2417fHeh0mHc77oMFX7ywTP8hBjw5OxcXr9MqwwoKDW wOkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:mime-version; bh=TiFEFDNoYtk9t6k5QWRwz20HX5DaJlFc2a+ZZbPMUjw=; b=LrmDepP7g2/JsxXHkEfkUTKjDBwKtllTLYjlPowE5mmcWZ96Rkd79TRQ1vrE+iAN0w Ma8kb7yrzrC5lTINJJn2c99lDoXzwqz2qGsD9jmE2sVw6n6QxqlpzvPVGc6pIrXmsr+9 +EPVRMsCwlbi9b4dieSLYvh9sRIKN32qNbQLI8TWkovQzYYHthS24MPWhHlJUYaG3qOP SPC46HuBRsgiooJ0nU1hsqtHrRdebfmiANAwWqZ2L2qYFAw1dzDS0U2pcDUngz8bD9BK uhEY44l2wLycWJNTtspunF14uHFYpug8jjhDMWJC6vwbl5lPslnHgUQeJM6gGphjChOM PTcA== X-Gm-Message-State: APf1xPDPddCUCGrSZCWfcRSvWQuyVpZmUnQ9af3tSkJWrkhEU5uAt9zi PQnIMmvT6k9b0uBznUbiwAm26D7j X-Google-Smtp-Source: AG47ELsgD5ToB+dFfauENYJM+hWTtY7C5WQRGByitlxYx+3UeMpXvGA2q3qlx7W2IimJGYSQqE924g== X-Received: by 10.223.199.71 with SMTP id b7mr27873627wrh.228.1520614465252; Fri, 09 Mar 2018 08:54:25 -0800 (PST) Original-Received: from rpluim-ubuntu ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id g78sm1623014wmc.31.2018.03.09.08.54.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 08:54:24 -0800 (PST) Mail-Copies-To: never Gmane-Reply-To-List: yes In-Reply-To: <83zi3husrr.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 09 Mar 2018 18:18:32 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:144081 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Robert Pluim >> Date: Fri, 09 Mar 2018 16:53:26 +0100 >> Cc: 30757@debbugs.gnu.org >> >> Here's what I've got so far. Suggestions welcome for wording, style >> changes, etc. > > Thanks. > >> --- a/etc/NEWS >> +++ b/etc/NEWS >> @@ -71,6 +71,12 @@ moved to the early init file (see above). >> >> * Changes in Emacs 27.1 >> >> ++++ > > "+++" means this change was documented in the manual(s), but this > change wasn't, AFAIU. Shkuld this be documented in the ELisp manual? > etc/NEWS says: +++ indicates that all necessary documentation updates are complete. (This means all relevant manuals in doc/ AND lisp doc-strings.) I'd looked through the manuals and couldn't see anywhere where I thought it should be documented, hence I only changed the doc-string. We can go for '---' in that case. >> +** Warning types can now be disabled from the warning buffer. >> +For each warning 'display-warning' now adds buttons to the buffer it >> +uses to allow permanent suppression of the warning popup or of the >> +warning itself. > > This entry should be made more clear. "Warning types" is never > explained, the reference to 'display-warning' is confusing (this is a > user-level feature, so why mention the function which is involved?), > it is unclear what buffer is alluded to by "the buffer it uses", and > the difference between "warning popup" and "warning itself" is left > unexplained. I've rewritten it. See attached. >> +(define-button-type 'warning-suppress-warning >> + 'action #'warning-suppress-action >> + 'help-echo "mouse-2, RET: Permanently disable popping up this warning") >> +(defun warning-suppress-action (button) >> + (customize-save-variable 'warning-suppress-types >> + (cons (list (button-get button 'warning-type)) >> + warning-suppress-types))) >> +(define-button-type 'warning-suppress-log-warning >> + 'action #'warning-suppress-log-action >> + 'help-echo "mouse-2, RET: Never generate this warning") > > Likewise here: the difference between "disable popping up" and "never > generate" is unclear. maybe a different wording will clarify that, > but I cannot suggest one because frankly I don't understand well > enough what each one does. Yes. I'm stuck between being precise but verbose, and more general and succinct, and expressing the permanence of the resulting change. I've make another attempt, although I'm still not entirely happy with it, especially since the button texts are now quite long (I thought about using the verb 'hide', but that's not accurate either). Robert --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Show-log-suppression-buttons-in-display-warning-buff.patch >From ba62307cfb0633637cc1fa9351c942cf79f34b90 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Fri, 9 Mar 2018 16:41:36 +0100 Subject: [PATCH] Show log suppression buttons in display-warning buffer * lisp/emacs-lisp/warnings.el (warning-suppress-warning): Define button. (warning-suppress-action): New function. (warning-suppress-log-warning): Define button. (warning-suppress-log-action): New function. (display-warning): Show buttons to allow permanent modification of warning-suppress-types and warning-suppress-log-types per warning. * etc/NEWS: Describe 'display-warning' button change. --- etc/NEWS | 10 +++++++++- lisp/emacs-lisp/warnings.el | 26 +++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 14926ba2e3..a36967d473 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -69,7 +69,15 @@ in your init file. However, if your init file changes the values of moved to the early init file (see above). -* Changes in Emacs 27.1 +* Changes in Emacs 27. + +--- +** Specific warnings can now be disabled from the warning buffer. +When a warning is displayed to the user, the resulting buffer now has +buttons which allow making permanent changes to the treatment of that +warning. Automatic showing of the warning can be disabled (although +it is still generated), or generation of the warning can be disabled +entirely. --- ** The new option 'tooltip-resize-echo-area' avoids truncating tooltip text diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el index 489611d4d1..245cd3f39a 100644 --- a/lisp/emacs-lisp/warnings.el +++ b/lisp/emacs-lisp/warnings.el @@ -197,6 +197,21 @@ warning-suppress-p ;; we return t. some-match)) +(define-button-type 'warning-suppress-warning + 'action #'warning-suppress-action + 'help-echo "mouse-2, RET: Don't display this warning automatically") +(defun warning-suppress-action (button) + (customize-save-variable 'warning-suppress-types + (cons (list (button-get button 'warning-type)) + warning-suppress-types))) +(define-button-type 'warning-suppress-log-warning + 'action #'warning-suppress-log-action + 'help-echo "mouse-2, RET: Never generate this warning again") +(defun warning-suppress-log-action (button) + (customize-save-variable 'warning-suppress-log-types + (cons (list (button-get button 'warning-type)) + warning-suppress-types))) + ;;;###autoload (defun display-warning (type message &optional level buffer-name) "Display a warning message, MESSAGE. @@ -223,7 +238,12 @@ display-warning See the `warnings' custom group for user customization features. See also `warning-series', `warning-prefix-function' and -`warning-fill-prefix' for additional programming features." +`warning-fill-prefix' for additional programming features. + +This will also display buttons allowing the user to permanently +disable automatic display of the warning or disable the warning +entirely by setting `warning-suppress-types' or +`warning-suppress-log-types' on their behalf." (if (not (or after-init-time noninteractive (daemonp))) ;; Ensure warnings that happen early in the startup sequence ;; are visible when startup completes (bug#20792). @@ -264,6 +284,10 @@ display-warning (insert (format (nth 1 level-info) (format warning-type-format typename)) message) + (insert " ") + (insert-button "Disable showing automatically" 'type 'warning-suppress-warning 'warning-type type) + (insert " ") + (insert-button "Never generate" '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) -- 2.16.1.72.g5be1f00a9 --=-=-=--