]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix warning-suppress for list type "warning type"
authorXuan Wang <code@wangxuan.name>
Fri, 29 Mar 2024 00:34:23 +0000 (20:34 -0400)
committerEshel Yaron <me@eshelyaron.com>
Sun, 7 Apr 2024 16:33:18 +0000 (18:33 +0200)
Per the documentation 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 previous
implementation could 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 (warnings-suppress): Fix saving
warning types in 'warning-suppress-types'.  (Bug#70063)

Copyright-paperwork-exempt: yes
(cherry picked from commit 46b8746b38e26ae3f216f57f231f5fc8aec22873)

lisp/emacs-lisp/warnings.el

index 6c62a56e99cea34bb4374757b6c859b725e73256..8b43c6a87262756f8158648282608e35bc6783ec 100644 (file)
@@ -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