From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Cassou Newsgroups: gmane.emacs.devel Subject: Using the content of a dynamic variable in a macro Date: Sat, 25 Feb 2023 09:34:07 +0100 Message-ID: <87o7pi9m9s.fsf@cassou.me> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27448"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Feb 25 09:57:42 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pVqNB-0006yd-Pa for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Feb 2023 09:57:41 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVqMW-00074f-JS; Sat, 25 Feb 2023 03:57:01 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVq0c-0003fN-Ly for emacs-devel@gnu.org; Sat, 25 Feb 2023 03:34:25 -0500 Original-Received: from mail.choca.pics ([2001:910:1410:500::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVq0a-0001bo-Up for emacs-devel@gnu.org; Sat, 25 Feb 2023 03:34:22 -0500 Original-Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id B0AF9180940B0 for ; Sat, 25 Feb 2023 09:34:08 +0100 (CET) Original-Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id P8lkZlvVmD58 for ; Sat, 25 Feb 2023 09:34:08 +0100 (CET) Original-Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id 39E85180940B1 for ; Sat, 25 Feb 2023 09:34:08 +0100 (CET) X-Virus-Scanned: amavisd-new at choca.pics Original-Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id 3DzNjYV7iW3v for ; Sat, 25 Feb 2023 09:34:08 +0100 (CET) Original-Received: from localhost (91.60.75.86.rev.sfr.net [86.75.60.91]) by mail.choca.pics (Postfix) with ESMTPSA id 076C6180940B0 for ; Sat, 25 Feb 2023 09:34:07 +0100 (CET) Received-SPF: pass client-ip=2001:910:1410:500::1; envelope-from=damien@cassou.me; helo=mail.choca.pics X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 25 Feb 2023 03:56:57 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:303785 Archived-At: 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"))) =20=20 (defmacro foo-macro () `(progn ,@foo-var)) =20=20 (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-comp= ile)' In toplevel form: foo.el:32:1: Error: Symbol=E2=80=99s value as variable is void: foo-var Why isn't the compiler aware of the foo-var variable? --=20 Damien Cassou "Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill