emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Visuwesh <visuweshm@gmail.com>
To: org-mode-email <emacs-orgmode@gnu.org>
Subject: Re: Bad interaction between org-capture entry type and file+function target?
Date: Thu, 21 Nov 2024 19:03:02 +0530	[thread overview]
Message-ID: <875xogbtkh.fsf@gmail.com> (raw)
In-Reply-To: <87h681b0l6.fsf@gmail.com> (Visuwesh's message of "Thu, 21 Nov 2024 11:16:45 +0530")

[வியாழன் நவம்பர் 21, 2024] Visuwesh wrote:

> In the attached file "test.org", I want to capture new headings above
> "Projects" always.  To achieve this, I used a file+function target to
> move the point above "Projects" like below
>
> [...]
>
> However, when evaluating this sexp, the heading "test" is always
> appended to the end of file contrary to what the docstring says:
>
>     (file+function "path/to/file" function-finding-location)
>         A function to find the right location in the file
>
> This is because of the 'else' clause in the cond form in
> org-capture-place-entry:
>
> [...]
>
> Should this be here?  Am I misunderstanding the documentation?  After
> all, it is too terse (the same text is in the Info manual too).  The
> documentation for the 'entry' type does not mention this quirk either:
>
>     entry       an Org node, with a headline.  Will be filed
>                 as the child of the target entry or as a  
>                 top-level entry.  Its default template is:
>                   "* %?\n%a"
>
> The documentation for :prepend does mention that entries will be
> inserted at the end if it is nil but I would think that using a function
> would rule this out.
>
> Changing the type to 'plain' from 'entry' works as expected though.

I just thought of a situation where this behaviour would be desired: a
template could use FUNCTION-FINDING-LOCATION to ask the user to choose a
heading (from a list, using org-ql, etc.) to capture the entry to go
_under_ it.  Here, the function would simply move the point to be on the
heading.
[ I am actually in the process of writing such a capture template.  ]

So perhaps an indicator to tell org-capture that I want to insert the
heading exactly _at_point_ is required instead?


      reply	other threads:[~2024-11-21 13:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-21  5:46 Bad interaction between org-capture entry type and file+function target? Visuwesh
2024-11-21 13:33 ` Visuwesh [this message]

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=875xogbtkh.fsf@gmail.com \
    --to=visuweshm@gmail.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).