emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: York Zhao <gtdplatform@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: org-capture with function type target
Date: Sat, 16 Nov 2013 20:13:31 -0500	[thread overview]
Message-ID: <CAD3zm20QTWjuHLXAW9JBnFSaXQqp3J+SbBWQ3FBdWaergco2zQ@mail.gmail.com> (raw)

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

             reply	other threads:[~2013-11-17  1:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-17  1:13 York Zhao [this message]
2013-11-18  1:32 ` org-capture with function type target York Zhao
2013-11-26  5:29   ` Carsten Dominik
2013-11-27  2:29     ` York Zhao

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=CAD3zm20QTWjuHLXAW9JBnFSaXQqp3J+SbBWQ3FBdWaergco2zQ@mail.gmail.com \
    --to=gtdplatform@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).