emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Chao LU <loochao@gmail.com>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: How to use variable in org publish function
Date: Thu, 18 Nov 2010 09:50:48 -0500	[thread overview]
Message-ID: <18958.1290091848@gamaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Chao LU <loochao@gmail.com> of "Thu\, 18 Nov 2010 01\:54\:42 EST." <AANLkTimV77d02wUdE_qd1j4Sx8UfbnnmTdxjyrKk694F@mail.gmail.com>

Chao LU <loochao@gmail.com> 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

  reply	other threads:[~2010-11-18 14:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-18  6:54 How to use variable in org publish function Chao LU
2010-11-18 14:50 ` Nick Dokos [this message]
2010-11-18 17:03   ` Chao LU

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18958.1290091848@gamaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=loochao@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).