* Capturing to second level headline that does not exist
@ 2012-08-31 21:20 John Hendy
2012-08-31 21:53 ` Nick Dokos
0 siblings, 1 reply; 2+ messages in thread
From: John Hendy @ 2012-08-31 21:20 UTC (permalink / raw)
To: emacs-orgmode
I'm sure this is trivial, but I'm missing it.
If I use file+olp to try something like this
#+begin_src .emacs
(setq org-capture-templates
`(("c" "clock" entry (file+olp "~/org/clocking.org"
,(format "%s"
(format-time-string "%Y"))
,(format "%s"
(format-time-string "%B")))
"*** %? %^G \n %u" :clock-in t :clock-result t)))
#+end_src
I get an error that the headline doesn't exist. But if I do it like this:
#+begin_src .emacs
(setq org-capture-templates
`( ("a" "clock2" entry (file+headline "~/org/clocking.org"
,(format "%s"
(format-time-string "%Y")))
,(format "** %s \n*** %%? %%^G \n %%u"
(format-time-string "%B"))
:clock-in t :clock-resume t)))
#+end_src
Then if I run this a few times, I get this:
,--- ~/org/clocking.org ---
| * 2012
| ** August
| *** test
| [2012-08-31 Fri]
| ** August
| *** test2
| [2012-08-31 Fri]
`----------------------------------
So... one won't create a new headline, and the other creates a
duplicate if there's another of the same type there. The second makes
sense since I'm passing a string to use for the entry... it just takes
that string and inserts it where I told it. But is there a way to make
file+olp make a new headline if it doesn't exist? Or another way to do
this?
Thanks,
John
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Capturing to second level headline that does not exist
2012-08-31 21:20 Capturing to second level headline that does not exist John Hendy
@ 2012-08-31 21:53 ` Nick Dokos
0 siblings, 0 replies; 2+ messages in thread
From: Nick Dokos @ 2012-08-31 21:53 UTC (permalink / raw)
To: John Hendy; +Cc: emacs-orgmode
John Hendy <jw.hendy@gmail.com> wrote:
> I'm sure this is trivial, but I'm missing it.
>
> If I use file+olp to try something like this
>
> #+begin_src .emacs
> (setq org-capture-templates
> `(("c" "clock" entry (file+olp "~/org/clocking.org"
> ,(format "%s"
> (format-time-string "%Y"))
> ,(format "%s"
> (format-time-string "%B")))
> "*** %? %^G \n %u" :clock-in t :clock-result t)))
> #+end_src
>
> I get an error that the headline doesn't exist. But if I do it like this:
>
> #+begin_src .emacs
> (setq org-capture-templates
> `( ("a" "clock2" entry (file+headline "~/org/clocking.org"
> ,(format "%s"
> (format-time-string "%Y")))
> ,(format "** %s \n*** %%? %%^G \n %%u"
> (format-time-string "%B"))
> :clock-in t :clock-resume t)))
> #+end_src
>
> Then if I run this a few times, I get this:
>
> ,--- ~/org/clocking.org ---
> | * 2012
> | ** August
> | *** test
> | [2012-08-31 Fri]
> | ** August
> | *** test2
> | [2012-08-31 Fri]
> `----------------------------------
>
> So... one won't create a new headline, and the other creates a
> duplicate if there's another of the same type there. The second makes
> sense since I'm passing a string to use for the entry... it just takes
> that string and inserts it where I told it. But is there a way to make
> file+olp make a new headline if it doesn't exist? Or another way to do
> this?
>
Can't you just pre-make the relevant structure in the file?
--8<---------------cut here---------------start------------->8---
* 2012
** August
** September
** October
...
--8<---------------cut here---------------end--------------->8---
Then the relevant headings are going to be present.
Nick
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-31 21:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-31 21:20 Capturing to second level headline that does not exist John Hendy
2012-08-31 21:53 ` Nick Dokos
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).