-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
(defvar test--var1 nil) ;; From https://github.com/raxod502/radian/blob/cb1dda7c8a697b2d6e3b2683805df6a085aed1c7/emacs/radian.el#L194 (defmacro my-when-compiletime (cond &rest body) "Like `when', but COND is evaluated at compile time. BODY is only compiled if COND evaluates to non-nil." (declare (indent 1)) (when (eval cond) (macroexp-progn body))) (defmacro my-log (s &rest args) "Log to *Messages*." `(when t (message (concat (propertize "the value is: " 'face 'font-lock-comment-face) (when (bound-and-true-p test--var1) (propertize (format "[%s/%s] " (substring (symbol-name (car test--var1)) 1) (cdr test--var1)) 'face 'warning)) ,s) ,@args))) ;; input should be an unquoted list containing like (:a b c) and c can be and ;; often is nil. The variable f take is included here for completeness but does ;; not do anything. (defmacro my-macro (input &rest body) (let ((c (car input)) (m (car (cdr input))) (f (cdr (cdr input)))) `(my-when-compiletime t (let ((test--var1 `(,,c . ,',m))) (message "test--var1 is %s" test--var1) (my-log "We are in my-macro") ,@body)))) ;; This works as expected (my-macro (:a b) (my-log "%s" test--var1)) ;; => test--var1 is (:a . b) ;; => the value is: [a/b] We are in my-macro ;; => the value is: [a/b] (:a . b) ;; => #("the value is: [a/b] (:a . b)" 0 14 (face font-lock-comment-face) 14 20 (face warning)) ;; This not (my-macro (:a b) (defun test-fun1 () (my-log "hey")) (run-with-timer 0.1 nil #'test-fun1)) ;; => test--var1 is (:a . b) ;; => the value is: [a/b] We are in my-macro ;; => [nil 24719 64999 224627 nil test-fun1 nil nil 964000] ;; => the value is: hey