emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-capture with function type target
@ 2013-11-17  1:13 York Zhao
  2013-11-18  1:32 ` York Zhao
  0 siblings, 1 reply; 4+ messages in thread
From: York Zhao @ 2013-11-17  1:13 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-27  2:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-17  1:13 org-capture with function type target York Zhao
2013-11-18  1:32 ` York Zhao
2013-11-26  5:29   ` Carsten Dominik
2013-11-27  2:29     ` York Zhao

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).