From 59a350cb911a1c488635d1eb447b07a509939125 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mattias=20Engdeg=C3=A5rd?= <mattiase@acm.org> Date: Sun, 2 Jul 2023 11:44:29 +0200 Subject: [PATCH] Warn about misplaced :success in condition-case (bug#64404) * lisp/emacs-lisp/bytecomp.el (byte-compile-condition-case): Warn if :success is part of a list of conditions (it must come alone). --- lisp/emacs-lisp/bytecomp.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 99202185d8d..262c658e258 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -5060,6 +5060,10 @@ binding slots have been popped." (byte-compile-warn-x condition "`condition-case' condition should not be quoted: %S" condition)) + (when (and (consp condition) (memq :success condition)) + (byte-compile-warn-x + condition + "`:success' must be the first element of a `condition-case' handler")) (unless (consp condition) (setq condition (list condition))) (dolist (c condition) (unless (and c (symbolp c)) -- 2.39.5