From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: Re: refiling as child with function-filing-location Date: Sun, 26 Oct 2014 10:38:51 -0700 Message-ID: <8761f6pw7o.fsf@ericabrahamsen.net> References: <87mw8oblc3.fsf@scilifelab.se> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57480) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiRhj-00035C-Ba for emacs-orgmode@gnu.org; Sun, 26 Oct 2014 13:34:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XiRhZ-00066R-FS for emacs-orgmode@gnu.org; Sun, 26 Oct 2014 13:34:11 -0400 Received: from plane.gmane.org ([80.91.229.3]:59111) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiRhZ-00066H-8y for emacs-orgmode@gnu.org; Sun, 26 Oct 2014 13:34:01 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XiRhX-0006pp-FA for emacs-orgmode@gnu.org; Sun, 26 Oct 2014 18:33:59 +0100 Received: from 63.226.249.211 ([63.226.249.211]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Oct 2014 18:33:59 +0100 Received: from eric by 63.226.249.211 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Oct 2014 18:33:59 +0100 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@gnu.org Per Unneberg writes: > Hi, > > I'm writing a custom function for use with a capture template, as > described in the section Template elements (sec 9.1.3.1) of the info > manual. My function does what I expect in that it finds the correct > heading (in my use case "Log") and returns point. However, if the Log > heading has no children, the capture template is filed as a sibling, and > not a child. I have spent some time now on this seemingly simple > problem, but being a newbie on elisp I must admit I'm stuck. I'm messing about with some similar template-placement routines, so I tried your recipe below, and it worked for me... Capture by default will create a child of the heading point is on, so I really don't see why this wouldn't work. You've stepped through the function and confirmed that the (goto-char (point-at-bol)) line leaves you at the "Log" heading? Is the tree structure folded or open at the time? You might try an (org-reveal) after the (org-clock-goto); I'm still not really clear on the interaction between visibility and heading insertion. I think you're note about "if cursor is at beginning of headline, same level used" doesn't really apply here, as the capture process does a lot more than just pasting a subtree. Anyway, I can't reproduce the problem -- do try messing with visibility... Eric