From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chao LU Subject: Re: How to use variable in org publish function Date: Thu, 18 Nov 2010 12:03:53 -0500 Message-ID: References: <18958.1290091848@gamaville.dokosmarshall.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1747707327==" Return-path: Received: from [140.186.70.92] (port=41907 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PJ7uE-0006vL-Vd for emacs-orgmode@gnu.org; Thu, 18 Nov 2010 12:04:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PJ7uA-0005jD-KQ for emacs-orgmode@gnu.org; Thu, 18 Nov 2010 12:04:15 -0500 Received: from mail-fx0-f41.google.com ([209.85.161.41]:45540) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PJ7uA-0005iz-Ck for emacs-orgmode@gnu.org; Thu, 18 Nov 2010 12:04:14 -0500 Received: by fxm20 with SMTP id 20so1789735fxm.0 for ; Thu, 18 Nov 2010 09:04:13 -0800 (PST) In-Reply-To: <18958.1290091848@gamaville.dokosmarshall.org> 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: nicholas.dokos@hp.com Cc: emacs-orgmode@gnu.org --===============1747707327== Content-Type: multipart/alternative; boundary=20cf304345147b6f2d049556c7e9 --20cf304345147b6f2d049556c7e9 Content-Type: text/plain; charset=ISO-8859-1 Hi Nick, It works perfectly, thanks a lot~ Chao On Thu, Nov 18, 2010 at 9:50 AM, Nick Dokos wrote: > Chao LU wrote: > > > Dear all, > > > > I'm trying to define a variable, to let org-mode know different path to > use when I'm under different system (Windows or Mac), but got trouble to get > it > > work. Here is the Code: > > > > ---- > > (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")) ;For under windows, it should be My Dropbox... > > (setq org-publish-project-alist > > '( > > ("org-notes" > > :base-directory org-source-dir))) > > ---- > > > > 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? > > > > 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 > --20cf304345147b6f2d049556c7e9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Nick,

It works perfectly, thanks a lot~

Chao

On Thu, Nov 18, 2010 at 9:50 AM, Nick Dokos <nicholas.dokos@hp.com= > wrote:
<= div class=3D"h5">Chao LU <loochao@g= mail.com> wrote:

> Dear all,
>
> I'm trying to define a variable, to let org-mode know different pa= th to use when I'm under different system (Windows or Mac), but got tro= uble to get it
> work. Here is the Code:
>
> ----
> (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&q= uot;)
> (if lch-mac-p (defvar org-source-dir "~/Dropbox/org/org" &qu= ot;org source dir"))=A0=A0=A0 ;For under windows, it should be My Drop= box...
> (setq org-publish-project-alist
> =A0=A0=A0=A0=A0 '(
> =A0=A0=A0 ("org-notes"
> =A0=A0=A0 =A0:base-directory org-source-dir)))
> ----
>
> Apparently, this doesn't work, since the variable org-source-dir w= ill not be evaluated inside the quote, but I really didn't find out how= to make it
> evaled... Does anyone has any hints?
>

You need backquote (similar to quote, but allows selective eval= uation
of internal structure) and the , (selective evaluation) mechanism:

(setq org-publish-project-alist
=A0 =A0 =A0`(("org-notes"
=A0 =A0 =A0 =A0 :base-directory ,org-source-dir)
=A0 =A0 =A0 =A0))

See section 13.5 of the Emacs Lisp Reference manual for more details.=

HTH,
Nick

--20cf304345147b6f2d049556c7e9-- --===============1747707327== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============1747707327==--