emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to use variable in org publish function
@ 2010-11-18  6:54 Chao LU
  2010-11-18 14:50 ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Chao LU @ 2010-11-18  6:54 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 766 bytes --]

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?

Thanks a lot.

Chao

[-- Attachment #1.2: Type: text/html, Size: 925 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to use variable in org publish function
  2010-11-18  6:54 How to use variable in org publish function Chao LU
@ 2010-11-18 14:50 ` Nick Dokos
  2010-11-18 17:03   ` Chao LU
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2010-11-18 14:50 UTC (permalink / raw)
  To: Chao LU; +Cc: nicholas.dokos, emacs-orgmode

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to use variable in org publish function
  2010-11-18 14:50 ` Nick Dokos
@ 2010-11-18 17:03   ` Chao LU
  0 siblings, 0 replies; 3+ messages in thread
From: Chao LU @ 2010-11-18 17:03 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1334 bytes --]

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:

> 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
>

[-- Attachment #1.2: Type: text/html, Size: 1992 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-18 17:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-18  6:54 How to use variable in org publish function Chao LU
2010-11-18 14:50 ` Nick Dokos
2010-11-18 17:03   ` Chao LU

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).