emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Problems with org-capture and file+function


From: Christopher J. White
Subject: [O] Problems with org-capture and file+function
Date: Sun, 22 Jul 2012 14:00:42 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0

Hi folks,

I'm trying to figure out the proper use of the 'file+function' target. The documentation indicates the entry will be a child of the target entry, but I'm not finding that to be the case for all cases.

As far as I can tell, the function is expected to put the point where the entry should go and return t.

Here's my org-capture templates:

(setq org-capture-templates
     ("x" "Test")
     ("x1" "Test function" entry
      (file+function
       "~/test.org"
       (lambda ()
         (goto-char (org-find-olp (list "Top" "A" "A1") t))
         t))
      "* Test A1"
      )

     ("x2" "Test function" entry
      (file+function
       "~/test.org"
       (lambda ()
         (goto-char (org-find-olp (list "Top" "A" "A1" "A1x") t))
         t))
      "* Test A1x")

     ("x3" "Test function" entry
      (file+function
       "~/test.org"
       (lambda ()
         (goto-char (org-find-olp (list "Top" "A" "A1" "A1x" "A1xx") t))
         t))
      "* Test A1xx")))

Start with this as a test.org:

* Top
** A
*** A1
**** A1x
***** A1xx
**** A1y
** B
*** B1
**** B1x

Then call org-capture for x1, then x2, then x3, and you get:

* Top
** A
*** Test A1
*** A1
**** Test A1x
**** A1x
***** Test A1xx
***** A1xx
**** A1y
** B
*** B1
**** B1x

I expected instead for the new entries to appear as subheadings of the target, something like:

* Top
** A
*** A1
**** A1x
***** A1xx
****** Test A1xx
***** Test A1x
**** A1y
*** Test A1
** B
*** B1
**** B1x

I've tried various things in the lambda() function:

1.  (org-end-of-subtree)

This just creates the entry at the end of the subtree, but as a child of the last entry.

2.  end-of-line

Fails if there is any body below the heading in question.

Is this a bug or am I doing something wrong?

Using:
  Emacs 23.4.1 on Mac
  Org-mode 7.8.03

Thanks
...cj



reply via email to

[Prev in Thread] Current Thread [Next in Thread]