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.help Subject: Using the content of a dynamic variable in a macro Date: Fri, 24 Feb 2023 07:31:35 +0100 Message-ID: <871qmftvzs.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="1533"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 26 10:47:06 2023 Return-path: Envelope-to: geh-help-gnu-emacs@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 1pWDcY-0000HL-9J for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 26 Feb 2023 10:47:06 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWDbv-0003if-00; Sun, 26 Feb 2023 04:46:27 -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 1pVRcU-0001QC-T6 for help-gnu-emacs@gnu.org; Fri, 24 Feb 2023 01:31:50 -0500 Original-Received: from mail.choca.pics ([80.67.172.235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVRcR-0000Pb-VD for help-gnu-emacs@gnu.org; Fri, 24 Feb 2023 01:31:50 -0500 Original-Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id B38E418095AB1 for ; Fri, 24 Feb 2023 07:31:36 +0100 (CET) Original-Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id W8HGm3MIeTeq for ; Fri, 24 Feb 2023 07:31:36 +0100 (CET) Original-Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id 4A1BE18095AB2 for ; Fri, 24 Feb 2023 07:31:36 +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 W7ywt64zwXn9 for ; Fri, 24 Feb 2023 07:31:36 +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 0FD7F18095AB1 for ; Fri, 24 Feb 2023 07:31:36 +0100 (CET) Received-SPF: pass client-ip=80.67.172.235; 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: Sun, 26 Feb 2023 04:46:23 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:142843 Archived-At: 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