[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using the content of a dynamic variable in a macro
From: |
Damien Cassou |
Subject: |
Using the content of a dynamic variable in a macro |
Date: |
Sat, 25 Feb 2023 09:34:07 +0100 |
I tried to send the mail below to help-gnu-emacs@gnu.org (without being
subscribed) but it never reached the archive:
https://lists.gnu.org/archive/html/help-gnu-emacs/2023-02/threads.html.
Hi,
I'm wondering why the code below works but won't compile.
foo.el:
(defvar foo-var '((message "hello world")))
(defmacro foo-macro ()
`(progn
,@foo-var))
(defun foo-fun ()
(foo-macro))
$ emacs --batch -l foo.el --eval '(foo-fun)'
hello world
$ emacs --batch --eval '(find-file "foo.el")' --eval '(emacs-lisp-byte-compile)'
In toplevel form:
foo.el:32:1: Error: Symbol’s value as variable is void: foo-var
Why isn't the compiler aware of the foo-var variable?
--
Damien Cassou
"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
- Using the content of a dynamic variable in a macro,
Damien Cassou <=
Re: Using the content of a dynamic variable in a macro, tomas, 2023/02/25
Re: Using the content of a dynamic variable in a macro, Basil Contovounesios, 2023/02/27