From mboxrd@z Thu Jan 1 00:00:00 1970 From: York Zhao Subject: org-capture with function type target Date: Sat, 16 Nov 2013 20:13:31 -0500 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vhqvf-0006C4-34 for emacs-orgmode@gnu.org; Sat, 16 Nov 2013 20:13:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vhqvc-0001DJ-En for emacs-orgmode@gnu.org; Sat, 16 Nov 2013 20:13:35 -0500 Received: from mail-ie0-x22b.google.com ([2607:f8b0:4001:c03::22b]:52503) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vhqvc-0001D0-8L for emacs-orgmode@gnu.org; Sat, 16 Nov 2013 20:13:32 -0500 Received: by mail-ie0-f171.google.com with SMTP id ar20so569915iec.30 for ; Sat, 16 Nov 2013 17:13:31 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org 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