From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.help Subject: Re: Simple macro question Date: Mon, 3 May 2021 03:29:38 +0200 Message-ID: <20210503012938.avvld6ncgry256nt@Ergus> References: <20210503000712.l2wh2liwhg3jfjxy.ref@Ergus> <20210503000712.l2wh2liwhg3jfjxy@Ergus> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29277"; 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 Mon May 03 03:31:04 2021 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 1ldNQN-0007W3-Gy for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 03 May 2021 03:31:03 +0200 Original-Received: from localhost ([::1]:44806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldNQM-00012m-JX for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 02 May 2021 21:31:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldNPT-00012e-1U for help-gnu-emacs@gnu.org; Sun, 02 May 2021 21:30:07 -0400 Original-Received: from sonic310-15.consmr.mail.bf2.yahoo.com ([74.6.135.125]:43515) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldNPP-0003iD-Mm for help-gnu-emacs@gnu.org; Sun, 02 May 2021 21:30:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1620005400; bh=5ItZSSsmQngbhCFP/ug8t5UvJPgganU3nfjEeXoT3v8=; h=Date:From:To:Subject:References:In-Reply-To:From:Subject:Reply-To; b=XZpK0Snvz3iSw/v4Ya9cGfm/+z85sx80rbUbL02DOEM5UaEN+BLKsPVNfZbt4MMLh/sRvUqAp7kK7ICejhJHUN6bO0daudxrmXRkFy5rKgVLLDm/4EGAYteg+VEcQG6rl9oDe8Hj/8tH9cuyxs9Hklc/GivaVpzt3OAVmh170RD2wzjicb5fMt1RfeHnXxIcyTnvhwBNIoB0JBx9MRFpI1I0O3AnhNGUES1XRjrM2Mm9NmCrDO2N6TUjVHyiCjD8+PyDQdBK1ZEFnk9iaZMvtwb46U9zY/bBrATbURtVANd6KdE5QcF67/+MrUPtoggezNrBK/pu+kSptB2u+0SwsA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1620005400; bh=ujtcatqdc+gd58Bn7Tl1NPBvXCEPGRD9p461aQcMi/z=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=j/vnF6k/0T6WzmBVQQYalVqj2WGAlje6QwJTnmijQcYJfJn7Jw01fBLqszMyxps7jXj5cB5tYiUfz8YGeTwN1rlctDy0hBvS9peKmXVVUzVAAGSqB+1vaC+pTBFH2LnZKL1wCa18udmIZ4TH5WrQVo7bt5cwDN2/Gw0VFuLMB7SfxkdHN0qM7g127xntyC3groMJ4Dm+eR25xonzZk+lJcIP94wNq8u7Ks3BvSHL2HmKLkJEBxIiwy6/aAfO2akZyfjEgZwLGo9CPMEDfEI3ZfdloyOT81V1cMHBcrLwtgDzg1SuZdKHJXSdqNEcApHC61bYJa4q+g6mqs0E974k3w== X-YMail-OSG: CIDb1MgVM1lSg3BrT9JKe2VJmu1TjiugsIQWYlUe6wbtuT.E.r8hAyjTIYaS0gB 7iCNYp0WmcBl6fF1n_qdDVcnRmdllolReCu3Ctb.aVx7XoflqEwHgPS8z_XyEptx6UjtnOprf8wN q.C4eKfPm.A7XdI_VIqa9N5DAmiZo.lmBK3c65tRpwnQb_YedL9oI707TNKbvcm_uOUIivFbKFHA FY4ii.hprjbiPQJOmzLrN5h37SbDRBIZ8PMRWLF8sEP7LRjhSs586v_Bq_fvGXjLOxYc.NnJCbEp ZOsFHGBZjZWGyU6TncZo6vOUO5C_A90.KMHZhkn1UAn.iV0z918WgOaOWER5xGV1DuIvw2uihyS3 fPGGxyaLV6el_Kwm52JqEeaLwvnf_fdTGzFVkArN.YMcl0oGcUQmSidUwaycVhDqyCK39St4aBzM 0HXeXEhRefemwvbrNgjmNIrkuzzsOma8QUJGR4IdjnOHsjTukqjN3asaZz31rZ26YgyYzD4vnYAQ jfoK9BOKiwac__cmIKDFcVsAU3m99j1ZyU5mxMZwUcCpOEu2B9icAjEvdr5fcfrZc0jZ_p.qhv9e tVkklcIsyb.8zLRCtcGW6RjsHXChWt659tQzFWMqPsEtxOUGEv9y9rMw85AAeqiVWf.jqoIcXin5 0UR9oa0Xu_Ce7zJBakPta2uwsG.lpMSlBsm_iVYvruwmXfq7KY69l9mxvQF.yzQT_avlCJvmedJU 3s_FIHaJ_3ZKZRrlIODgLAPlvz0MqPqwQl2g_pNj3quf50ufL1cXmHGEPbj.YJ_VTaAtPT0FOGYH eWrUYgxitpA8scO5UmPmVS8trI6Pptd6R6DfyunBkZ X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.bf2.yahoo.com with HTTP; Mon, 3 May 2021 01:30:00 +0000 Original-Received: by kubenode512.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 021fb5bae5cac5cbcc69baa545cba41a; Mon, 03 May 2021 01:29:57 +0000 (UTC) Content-Disposition: inline In-Reply-To: <20210503000712.l2wh2liwhg3jfjxy@Ergus> X-Mailer: WebService/1.1.18138 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Apache-HttpAsyncClient/4.1.4 (Java/16) Received-SPF: pass client-ip=74.6.135.125; envelope-from=spacibba@aol.com; helo=sonic310-15.consmr.mail.bf2.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.help:129361 Archived-At: Equivalent code like this: ==================== ;;; test.el --- test editing -*- lexical-binding: t; -*- ;;; Commentary: ;;; Code: (defvar test-commands-list '(A B C) "List of replaced functions.") (defun test-fun (com) "Testfun with COM." nil) (defmacro test-def (thelist) "Doc def." `(progn ,@(mapcar #'test-fun thelist))) (test-def (A B C)) (provide 'test) ;;; test ends here ============================ Says that: Symbol’s function definition is void: test-fun On Mon, May 03, 2021 at 02:07:12AM +0200, Ergus wrote: > >Hi: > >Playing with macros to generate function I got an problem I am not sure >how to solve or why is it an issue > >In the following minimal code: > >============================== > >;;; test.el --- test editing -*- lexical-binding: t; -*- > >;;; Commentary: > >;;; Code: > >(defvar test-commands-list '(A B C) > "List of replaced functions.") > >(defmacro test-def () > "Doc def." > `(eval-and-compile ,@(mapcar (lambda (com) nil) test-commands-list))) > >(test-def) > >(provide 'test) >;;; test ends here > >============================== > >This code shows an error like: > >Symbol’s value as variable is void: test-commands-list > >in this line: (test-def) > >I can't use test-commands-list either in this way or as an input if I >define the macro as: > >(defmacro test-def (commands-list) >... > >(test-def test-commands-list) > >In this second case I get: wrong arguments sequencep test-commands-list > >Is this intended? > >