emacs-orgmode
[Top][All Lists]
Advanced

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

[O] Capturing to second level headline that does not exist


From: John Hendy
Subject: [O] Capturing to second level headline that does not exist
Date: Fri, 31 Aug 2012 16:20:53 -0500

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



reply via email to

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