emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Problems with org-capture and file+function
@ 2012-07-22 18:00 Christopher J. White
  0 siblings, 0 replies; only message in thread
From: Christopher J. White @ 2012-07-22 18:00 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-07-22 18:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-22 18:00 Problems with org-capture and file+function Christopher J. White

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).