To whom it may concern,

Please find attached my patch to address this issue. Please let me
know if the patch is acceptable.

Thanks,

York


On Sat, Nov 16, 2013 at 8:13 PM, York Zhao <gtdplatf...@gmail.com> wrote:
> 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

Attachment: 0001-org-capture-place-entry-Do-not-special-casing-for-ex.patch
Description: Binary data

Reply via email to