From 2de25accaf31aef643557ec476041c770fc7ac15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Thu, 29 Dec 2022 12:00:50 +0100 Subject: Warn about `condition-case' with quoted condition names * lisp/emacs-lisp/bytecomp.el (byte-compile-condition-case): Add warning. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-warn-quoted-condition): Add test case. --- test/lisp/emacs-lisp/bytecomp-tests.el | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/lisp/emacs-lisp') diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 0d62283c04a..61f4998f6ba 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -923,6 +923,11 @@ byte-compiled. Run with dynamic binding." `(defvar foo t ,bytecomp-tests--docstring))) (ert-deftest bytecomp-warn-quoted-condition () + (bytecomp--with-warning-test + "Warning: `condition-case' condition should not be quoted: 'arith-error" + '(condition-case nil + (abc) + ('arith-error "ugh"))) (bytecomp--with-warning-test "Warning: `ignore-error' condition argument should not be quoted: 'error" '(ignore-error 'error (abc)))) -- cgit v1.2.1