emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-capture templates with file+olp target
@ 2010-08-23  3:56 Erik Iverson
  2010-08-23  4:00 ` Erik Iverson
  2010-08-23 18:54 ` David Maus
  0 siblings, 2 replies; 3+ messages in thread
From: Erik Iverson @ 2010-08-23  3:56 UTC (permalink / raw)
  To: Emacs-orgmode

Hello,

Using latest org-mode from git.

I'm trying to set up a simple org-capture template, to write
to a file test.org.  The first two lines below simply
define a path to some org mode file.

My confusion with the template is when I invoke org-capture --
I have it set to C-c c --, and then hit `t`, everything works
as I'd hope. (the file+headline target)

But when I hit `b`, (the file+olp target), I get an error,
which I can avoid by hardcoding the filename instead of using
the org-test-file variable in that case.  I get the error:

find-file-noselect: Wrong type argument: stringp, org-test-file

from the org-find-olp function in org.el.

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

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

* Re: org-capture templates with file+olp target
  2010-08-23  3:56 org-capture templates with file+olp target Erik Iverson
@ 2010-08-23  4:00 ` Erik Iverson
  2010-08-23 18:54 ` David Maus
  1 sibling, 0 replies; 3+ messages in thread
From: Erik Iverson @ 2010-08-23  4:00 UTC (permalink / raw)
  To: Emacs-orgmode


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

Oops, /tmp/test.org I suppose.

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

* Re: org-capture templates with file+olp target
  2010-08-23  3:56 org-capture templates with file+olp target Erik Iverson
  2010-08-23  4:00 ` Erik Iverson
@ 2010-08-23 18:54 ` David Maus
  1 sibling, 0 replies; 3+ messages in thread
From: David Maus @ 2010-08-23 18:54 UTC (permalink / raw)
  To: Erik Iverson; +Cc: Emacs-orgmode


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

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.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 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-08-23 18:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-23  3:56 org-capture templates with file+olp target Erik Iverson
2010-08-23  4:00 ` Erik Iverson
2010-08-23 18:54 ` David Maus

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