summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorRichard M Stallman <rms@gnu.org>2024-02-03 17:47:02 -0500
committerRichard Stallman <rms@gnu.org>2024-02-03 18:12:10 -0500
commitb0049c942b8fa4093a02a9bb4ffc9c5da2261765 (patch)
tree95a74a22eb62b05a3115c4584daeab6d5a385d51 /lisp/emacs-lisp
parentd41cdceb133e30c71a95fe893d70645472b326e3 (diff)
downloademacs-b0049c942b8fa4093a02a9bb4ffc9c5da2261765.tar.gz
emacs-b0049c942b8fa4093a02a9bb4ffc9c5da2261765.tar.bz2
emacs-b0049c942b8fa4093a02a9bb4ffc9c5da2261765.zip
bytecomp.el: Warn for `,' not within backquote construct
(bytecomp--report-comma): New function with `compiler-macro' property.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/bytecomp.el10
1 files changed, 10 insertions, 0 deletions
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)