Kristoffer Balintona <krisbalint...@gmail.com> writes:

> Currently, `org-find-olp' assumes that it is being passed a file path +
> an outline path, but when the olp function returns nil, only a file path
> is returned, so `org-find-olp' ends up returning nil when
> `org-capture-set-target-location' expects it to return a marker. Since
> `org-find-olp' is always run when the outline-path parameter is
> provided, we run into issues when it is a function returning nil.

> Taking a look at the code, it seems like file+olp+datetree and file+olp
> both behave like this.
>
> So my question is: which parts of the code should handle an outline-path
> function returning nil? Should we change the behavior of `org-find-olp'
> and/or `'org-capture-expand-olp', or should we change things just in
> `org-capture-set-target-location'?

I think that we should leave `org-find-olp' alone - it is used in more
general scope (outside org-capture), and it is not at all clear where
the marker to file-only path should point.

In contrast, `org-capture-exapnd-olp' was introduced to handle various
forms of the outline path specification in the capture template. If we
want to add a new meaning to that specification (returned or explicit
nil value), it is perfectly fine to change that function.

> With respect to file+headline: I think a similar dilemma applies there.
> It looks like the relevant function is `org-capture-expand-headline':
> should we change that function to handle the case of its argument being
> a function that returns nil or have that handling in
> `org-capture-set-target-location'?

`org-capture-expand-headline' serves the same purpose as
`org-capture-expand-olp' - helper function to parse possible capture
template specifications. We can extend it.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to