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)) + +(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)