emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] org-capture templates with file+olp target


From: David Maus
Subject: Re: [Orgmode] org-capture templates with file+olp target
Date: Mon, 23 Aug 2010 20:54:52 +0200
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/23.2 (i486-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

Erik Iverson wrote:
>I tried to debug, and it looks like that variable is not getting
>evaluated for some reason.  I'm sure it's obvious to someone,
>but is there a way around this?

>Hardcoding the path is actually problematic, since my org
>files are passed around various machines using git/Dropbox,
>and therefore the path is different depending on where I
>am located.

>Below is the simplest example I could come up with, just
>create a ~/test.org file and try it out.

>   ;; a path to some org-files
>   (setq org-test-path "/tmp")
>   ;; a specific org-file
>   (setq org-test-file (concat org-test-path "/test.org"))

>   (setq org-capture-templates
>         '(("t" "Todo" entry (file+headline org-test-file "Tasks")
>            "* TODO %?\n  %i\n  %a")
>           ("b" "Buy" item (file+olp org-test-file "Stuff to Buy" "House")
>            "")))

The symbol `org-test-file' is indeed not evaluated because the entire
template list is quoted.  You can use backquotes (Elisp manual, 13.5)
to tell Emacs to evaluate parts of the lisp:

,----
| (setq org-capture-templates
|       `(("t" "Todo" entry (file+headline ,org-test-file "Tasks")
|        "* TODO %?\n  %i\n  %a")
|       ("b" "Buy" item (file+olp ,org-test-file "Stuff to Buy" "House")
|        "")))
`----

The lisp starts with the backtick (`) and all expressions that are
prefix by comma (,) are evaluated.

HTH,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... address@hidden
Email..... address@hidden

Attachment: pgp45IUypMBga.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]