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: Meta-code confusion Date: Fri, 10 Aug 2012 19:12:08 +0000 Message-ID: <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 1344625968 29697 80.91.229.3 (10 Aug 2012 19:12:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Aug 2012 19:12:48 +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 21:12:45 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 1Szuck-0004p1-SN for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Aug 2012 21:11:54 +0200 Original-Received: from localhost ([::1]:35246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Szuck-0005X8-0b for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Aug 2012 15:11:54 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Szucd-0005X3-Qn for help-gnu-emacs@gnu.org; Fri, 10 Aug 2012 15:11:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Szucc-0008E2-UD for help-gnu-emacs@gnu.org; Fri, 10 Aug 2012 15:11:47 -0400 Original-Received: from mailhost.shubertorg.com ([207.246.209.200]:51391 helo=webmail.shubertorg.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Szucc-0008Dr-QR for help-gnu-emacs@gnu.org; Fri, 10 Aug 2012 15:11:46 -0400 Original-Received: from dakiya1.pegasus.local ([::1]) by DAKIYA1.pegasus.local ([::1]) with mapi id 14.01.0339.001; Fri, 10 Aug 2012 15:12:09 -0400 Thread-Topic: Meta-code confusion Thread-Index: Ac13K/imSqBA04+IQu6lBdkZpBjCxg== Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-cr-hashedpuzzle: BP3K BjJa D1Jl D5mq EKfB EPKn EcDp ElZG EvKf FMNh Foy4 GwV1 HtWf IhmF KvTU LyC8; 1; aABlAGwAcAAtAGcAbgB1AC0AZQBtAGEAYwBzAEAAZwBuAHUALgBvAHIAZwA=; Sosha1_v1; 7; {2868C9C5-871F-4FC2-84B4-4B6159A00E8F}; ZABvAHUAZwBsAEAAcwBoAHUAYgBlAHIAdAB0AGkAYwBrAGUAdABpAG4AZwAuAGMAbwBtAA==; Fri, 10 Aug 2012 19:11:40 GMT; TQBlAHQAYQAtAGMAbwBkAGUAIABjAG8AbgBmAHUAcwBpAG8AbgA= x-cr-puzzleid: {2868C9C5-871F-4FC2-84B4-4B6159A00E8F} 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:86305 Archived-At: 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. As a starting point I'm failing with the following: (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)))) I want all such functions to return a list of definitions of the type of in= terest. 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: (car (ppm-define-vars "douglas" "dug")) =3D> (defvar *pp-dug-start-re* (concat "^douglas\\s-+" *pp-symbol-re*)) And (eval) looks like it does the right thing: (eval (car (ppm-define-vars "douglas" "dug"))) =3D> *pp-dug-start-re* (defvar) returns a symbol and (symbolp) confirms that that is a symbol. However, using *pp-dug-start-re* gets a void-variable error. On the other hand=20 (boundp (eval (car (ppm-define-vars "douglas" "dug")))) =3D> t which would seem to be a contradiction. I'm using=20 GNU Emacs 24.1.1 (i686-pc-cygwin, GTK+ Version 2.24.10) of 2012-07-17 on fi= ona and GNU Emacs 24.1.1 (powerpc-ibm-aix6.1.0.0, X toolkit, Xaw scroll bars) of 20= 12-07-25 on devlpar1. I would gladly pay with a beer=B9 to understand this better. ,Douglas Douglas Lewan Shubert Ticketing (201) 489-8600 ext 224 There is no national science just as there is no national multiplication ta= ble; 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.