From: Richard M Stallman Date: Sat, 3 Feb 2024 22:47:02 +0000 (-0500) Subject: bytecomp.el: Warn for `,' not within backquote construct X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d6cb104f019eb2c004bffe0c988feff878cc8cb0;p=emacs.git bytecomp.el: Warn for `,' not within backquote construct (bytecomp--report-comma): New function with `compiler-macro' property. (cherry picked from commit b0049c942b8fa4093a02a9bb4ffc9c5da2261765) --- diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 6e66771658e..5d2aa3355be 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -5742,6 +5742,16 @@ and corresponding effects." (eval form) form))) +;; Report comma operator used outside of backquote. +;; Inside backquote, backquote will transform it before it gets here. + +(put '\, 'compiler-macro #'bytecomp--report-comma) +(defun bytecomp--report-comma (form &rest _ignore) + (macroexp-warn-and-return + (format-message "`%s' called -- perhaps used not within backquote" + (car form)) + form (list 'suspicious (car form)) t)) + ;; Check for (in)comparable constant values in calls to `eq', `memq' etc. (defun bytecomp--dodgy-eq-arg-p (x number-ok)