[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] org-capture with function type target
From: |
York Zhao |
Subject: |
[O] org-capture with function type target |
Date: |
Sat, 16 Nov 2013 20:13:31 -0500 |
Hi list,
I'm been so frustrated when trying to use function as `target' in an
org-capture' template, here is my example:
1. Create a file "~/test.org" and add a line "* Level 1", make sure to add a
newline character after the inserted line
2. Set org-capture-template as:
(setq org-capture-templates
`(("t"
"Test"
entry
(function
(lambda ()
(set-buffer (org-capture-target-buffer "~/test.org"))
(goto-char (point-max))))
"* Level 2"
:immediate-finish t)))
3. Type "C-c c t"
4. The result of "test.org" becomes:
* Level 1
* Level 2
But what I wanted is:
* Level 1
** Level 2
I looked into "org-capture.el" and figured out that it is because when
`:exact-position' is set, function `org-capture-place-entry' never insert
template as a child of current entry. And `:exact-position' is set when Target
is a function.
I don't understand why it is designed this way, does it have to be this way?
what can I do if I want to insert "Level 2" as a child of "Level 1" while using
a function as template target?
Thanks,
York
- [O] org-capture with function type target,
York Zhao <=