From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: How to use variable in org publish function Date: Thu, 18 Nov 2010 09:50:48 -0500 Message-ID: <18958.1290091848@gamaville.dokosmarshall.org> References: Reply-To: nicholas.dokos@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=48358 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PJ5pO-00057R-06 for emacs-orgmode@gnu.org; Thu, 18 Nov 2010 09:51:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PJ5pI-00036r-8t for emacs-orgmode@gnu.org; Thu, 18 Nov 2010 09:51:05 -0500 Received: from vms173005pub.verizon.net ([206.46.173.5]:39197) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PJ5pI-00036i-5e for emacs-orgmode@gnu.org; Thu, 18 Nov 2010 09:51:04 -0500 Received: from gamaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173005.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LC3009TH58PPOD0@vms173005.mailsrvcs.net> for emacs-orgmode@gnu.org; Thu, 18 Nov 2010 08:50:50 -0600 (CST) In-reply-to: Message from Chao LU of "Thu\, 18 Nov 2010 01\:54\:42 EST." List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Chao LU Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org Chao LU wrote: > Dear all, >=20 > I'm trying to define a variable, to let org-mode know different path to u= se when I'm under different system (Windows or Mac), but got trouble to get= it > work. Here is the Code: >=20 > ---- > (defconst lch-win32-p (eq system-type 'windows-nt) "Are we on Windows?") > (defconst lch-mac-p (eq system-type 'darwin) "Are we on Mac") > (if lch-mac-p (defvar org-source-dir "~/Dropbox/org/org" "org source dir"= ))=C2=A0=C2=A0=C2=A0 ;For under windows, it should be My Dropbox... > (setq org-publish-project-alist > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 '( > =C2=A0=C2=A0=C2=A0 ("org-notes" > =C2=A0=C2=A0=C2=A0 =C2=A0:base-directory org-source-dir))) > ---- >=20 > Apparently, this doesn't work, since the variable org-source-dir will not= be evaluated inside the quote, but I really didn't find out how to make it > evaled... Does anyone has any hints? >=20 You need backquote (similar to quote, but allows selective evaluation of internal structure) and the , (selective evaluation) mechanism: (setq org-publish-project-alist `(("org-notes" :base-directory ,org-source-dir) )) See section 13.5 of the Emacs Lisp Reference manual for more details. HTH, Nick