emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master b0049c942b8: bytecomp.el: Warn for `, ' not within backquote cons


From: Richard M. Stallman
Subject: master b0049c942b8: bytecomp.el: Warn for `, ' not within backquote construct
Date: Sat, 3 Feb 2024 18:13:36 -0500 (EST)

branch: master
commit b0049c942b8fa4093a02a9bb4ffc9c5da2261765
Author: Richard M Stallman <rms@gnu.org>
Commit: Richard Stallman <rms@gnu.org>

    bytecomp.el: Warn for `,' not within backquote construct
    
    (bytecomp--report-comma): New function with `compiler-macro' property.
---
 lisp/emacs-lisp/bytecomp.el | 10 ++++++++++
 1 file changed, 10 insertions(+)

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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]