From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Doug Lewan Newsgroups: gmane.emacs.help Subject: RE: Meta-code confusion Date: Fri, 10 Aug 2012 21:38:26 +0000 Message-ID: <155DEC68569B714B86C2C7075F5EDA98268CCCE3@DAKIYA1.pegasus.local> References: <155DEC68569B714B86C2C7075F5EDA98268CCCBB@DAKIYA1.pegasus.local> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1344634692 31271 80.91.229.3 (10 Aug 2012 21:38:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Aug 2012 21:38:12 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 10 23:38:13 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SzwuK-0003bc-KW for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Aug 2012 23:38:12 +0200 Original-Received: from localhost ([::1]:44492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzwuJ-0004pb-Bt for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Aug 2012 17:38:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzwuD-0004pK-SX for help-gnu-emacs@gnu.org; Fri, 10 Aug 2012 17:38:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SzwuB-0006WF-Mx for help-gnu-emacs@gnu.org; Fri, 10 Aug 2012 17:38:05 -0400 Original-Received: from mailhost.shubertorg.com ([207.246.209.200]:18198 helo=webmail.shubertorg.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzwuB-0006Vw-J1 for help-gnu-emacs@gnu.org; Fri, 10 Aug 2012 17:38:03 -0400 Original-Received: from dakiya1.pegasus.local ([::1]) by DAKIYA1.pegasus.local ([::1]) with mapi id 14.01.0339.001; Fri, 10 Aug 2012 17:38:26 -0400 Thread-Topic: Meta-code confusion Thread-Index: Ac13K/imSqBA04+IQu6lBdkZpBjCxgAFAEog In-Reply-To: <155DEC68569B714B86C2C7075F5EDA98268CCCBB@DAKIYA1.pegasus.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-cr-hashedpuzzle: Alkv BCxs BYFJ BisQ DELQ Dnfy EAWi FBeC G3bT HgC7 H/VQ JYyr JdUe KTB8 Krhz Ktby; 1; aABlAGwAcAAtAGcAbgB1AC0AZQBtAGEAYwBzAEAAZwBuAHUALgBvAHIAZwA=; Sosha1_v1; 7; {63D72A8C-9700-4169-9F2C-7EB84B9090F5}; ZABvAHUAZwBsAEAAcwBoAHUAYgBlAHIAdAB0AGkAYwBrAGUAdABpAG4AZwAuAGMAbwBtAA==; Fri, 10 Aug 2012 21:37:59 GMT;UgBFADoAIABNAGUAdABhAC0AYwBvAGQAZQAgAGMAbwBuAGYAdQBzAGkAbwBuAA== x-cr-puzzleid: {63D72A8C-9700-4169-9F2C-7EB84B9090F5} x-originating-ip: [10.0.21.202] X-detected-operating-system: by eggs.gnu.org: Windows XP/2000 (RFC1323+, w+, tstamp-) X-Received-From: 207.246.209.200 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:86306 Archived-At: Well, after a few more hours I have a work-around. I think the original pro= blem was because (defvar) is a special form, but I'm still not sure. The current work-around is to build a string that looks right and then (eva= l (read THAT-STRING)) and let the results of that be the return value. I ca= n't see the interesting difference, but it does what I want. ,Doug > -----Original Message----- > From: help-gnu-emacs-bounces+dougl=3Dshubertticketing.com@gnu.org > [mailto:help-gnu-emacs-bounces+dougl=3Dshubertticketing.com@gnu.org] On > Behalf Of Doug Lewan > Sent: Friday, 2012 August 10 15:12 > To: help-gnu-emacs@gnu.org > Subject: Meta-code confusion >=20 > I have development environment that has a handful of files with > isomorphic (but not identical) structures. > I'd like to use the same code to define modes for all of them, but > clearly there are things I don't understand about writing meta-code in > emacs lisp. >=20 > As a starting point I'm failing with the following: >=20 > (defvar *pp-symbol-re* "\\(?:\\s_\\|\\sw\\)") > (defun ppm-define-vars (name abbreviation) > "Build a list of vars for the new mode." > (let* ((start-var-name (format "*pp-%s-start-re*" abbreviation)) > (start-var (make-symbol start-var-name)) > (start-re (list 'concat (format "^%s\\s-+" name) '*pp-symbol- > re*))) > (list (list 'defvar start-var start-re)))) >=20 > I want all such functions to return a list of definitions of the type > of interest. > This one happens to return a list of one element, [I would like] a > variable definition. > It certainly looks like it's returning the right kind of thing: >=20 > (car (ppm-define-vars "douglas" "dug")) > =3D> (defvar *pp-dug-start-re* (concat "^douglas\\s-+" *pp-symbol-re*)) >=20 > And (eval) looks like it does the right thing: > (eval (car (ppm-define-vars "douglas" "dug"))) > =3D> *pp-dug-start-re* >=20 > (defvar) returns a symbol and (symbolp) confirms that that is a symbol. >=20 > However, using *pp-dug-start-re* gets a void-variable error. > On the other hand > (boundp (eval (car (ppm-define-vars "douglas" "dug")))) > =3D> t > which would seem to be a contradiction. >=20 > I'm using > GNU Emacs 24.1.1 (i686-pc-cygwin, GTK+ Version 2.24.10) of 2012-07-17 > on fiona and > GNU Emacs 24.1.1 (powerpc-ibm-aix6.1.0.0, X toolkit, Xaw scroll bars) > of 2012-07-25 on devlpar1. >=20 > I would gladly pay with a beer=B9 to understand this better. >=20 > ,Douglas > Douglas Lewan > Shubert Ticketing > (201) 489-8600 ext 224 >=20 > There is no national science just as there is no national > multiplication table; what is national is no longer science. - Anton > Checov > _____________ > =B9 "beer" is a variable, replace it with an appropriate value should > beer be distasteful to you or otherwise inappropriate. >=20