emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Christopher J. White" <orgmode@grierwhite.com>
To: emacs-orgmode@gnu.org
Subject: Problems with org-capture and file+function
Date: Sun, 22 Jul 2012 14:00:42 -0400	[thread overview]
Message-ID: <500C3FCA.1070304@grierwhite.com> (raw)

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	other threads:[~2012-07-22 18:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=500C3FCA.1070304@grierwhite.com \
    --to=orgmode@grierwhite.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).