emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Hendy <jw.hendy@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Capturing to second level headline that does not exist
Date: Fri, 31 Aug 2012 16:20:53 -0500	[thread overview]
Message-ID: <CA+M2ft_3Bi7-SuCMhJBe14W+sv2dLuGbm6kGSVCs1JbfNK5PoA@mail.gmail.com> (raw)

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	other threads:[~2012-08-31 21:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-31 21:20 John Hendy [this message]
2012-08-31 21:53 ` Capturing to second level headline that does not exist Nick Dokos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+M2ft_3Bi7-SuCMhJBe14W+sv2dLuGbm6kGSVCs1JbfNK5PoA@mail.gmail.com \
    --to=jw.hendy@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).