emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [FR] Support headline as a function for file+headline target for org


From: Ihor Radchenko
Subject: Re: [FR] Support headline as a function for file+headline target for org-capture-templates
Date: Sat, 11 May 2024 17:41:07 +0000

Nafiz Islam <nafiz.islam1001@gmail.com> writes:

> I see there are a lot of test cases for org-find-olp (which is the function
> I believe processes the outline path argument).
>
> testing/lisp/test-org.el
> 2861:(ert-deftest test-org/org-find-olp ()
> 2862:  "Test `org-find-olp' specifications."
> 2875:    (should (org-find-olp '("Headline") t))
> 2876:    (should-error (org-find-olp '("Headline" "Test") t))
> 2877:    (should-error (org-find-olp '("Headlinealksjd") t))
> 2878:    (should (org-find-olp '("Headline" "headline2") t))
> 2879:    (should (org-find-olp '("Headline" "headline3") t))
> 2880:    (should (org-find-olp '("Headline" "headline3" "headline4") t))
> 2881:    (should-error (org-find-olp '("Headline" "headline5") t))
> 2882:    (should (org-find-olp '("Headline" "headline6") t))
> 2883:    (should (org-find-olp '("Headline" "headline7") t))
> 2884:    (should (org-find-olp '("Headline" "headline8") t))
>
> How should I go about testing different parameter types such as function
> and symbol?

I do not think that you need to modify `org-find-olp' itself.

Instead, do what is already done for resolving the file name:

(org-find-olp (cons (org-capture-expand-file path)
                    (org-capture-expand-olp outline-path)))

`org-capture-expand-olp' is the new function to be implemented.

Then, all you need in terms of tests is to add a test case into
`test-org-capture/entry' and, if you want, write a new test for
`org-capture-expand-olp'.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
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

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