From 57084c8de073c8ca1e74b98ca67e08b88813c42e Mon Sep 17 00:00:00 2001 From: Xuan Wang Date: Thu, 28 Mar 2024 20:34:23 -0400 Subject: [PATCH] fix warning-suppress for list type "warning type" Per the document of warning-suppress-types and the implementation of warning-suppress-p, a warning type can be either a symbol or a list of symbols. The old implementation can generate wrong warning-suppress-types. old behavior: type warning-suppress-types pkg -> '((pkg)) Correct (pkg subtype) -> '(((pkg subtype))) Incorrect Now we check whether type is a cons cell first. (Should not use listp here as listp returns t for nil) new behavior: type warning-suppress-types pkg -> '((pkg)) Correct (pkg subtype) -> '((pkg subtype)) Correct --- lisp/emacs-lisp/warnings.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el index 6c62a56e99c..8b43c6a8726 100644 --- a/lisp/emacs-lisp/warnings.el +++ b/lisp/emacs-lisp/warnings.el @@ -225,10 +225,14 @@ SUPPRESS-LIST is the list of kinds of warnings to suppress." (?q "quit and do nothing")))) (?y (customize-save-variable 'warning-suppress-log-types - (cons (list type) warning-suppress-log-types))) + (if (consp type) + (cons type warning-suppress-log-types) + (cons (list type) warning-suppress-log-types)))) (?n (customize-save-variable 'warning-suppress-types - (cons (list type) warning-suppress-types))) + (if (consp type) + (cons type warning-suppress-types) + (cons (list type) warning-suppress-types)))) (_ (message "Exiting")))) ;;;###autoload -- 2.34.1