From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Capturing to second level headline that does not exist Date: Fri, 31 Aug 2012 17:53:22 -0400 Message-ID: <11609.1346450002@alphaville.americas.hpqcorp.net> References: Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:48043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7Z9a-0004z9-MU for emacs-orgmode@gnu.org; Fri, 31 Aug 2012 17:53:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7Z9Z-0003Rb-L8 for emacs-orgmode@gnu.org; Fri, 31 Aug 2012 17:53:26 -0400 Received: from g1t0026.austin.hp.com ([15.216.28.33]:23138) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7Z9Z-0003RO-EX for emacs-orgmode@gnu.org; Fri, 31 Aug 2012 17:53:25 -0400 In-Reply-To: Message from John Hendy of "Fri, 31 Aug 2012 16:20:53 CDT." List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: John Hendy Cc: emacs-orgmode John Hendy 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