emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Nafiz Islam <nafiz.islam1001@gmail.com>
Cc: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87wmo0tff0.fsf@localhost> (raw)
In-Reply-To: <CAKjtFcSUUH7k2EbCaXFO813hqNsAQahnK=hqCaxeTxL6fiqKRQ@mail.gmail.com>

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	other threads:[~2024-05-11 17:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-28 14:58 [FR] Support headline as a function for file+headline target for org-capture-templates Nafiz Islam
2024-04-28 15:48 ` Nafiz Islam
2024-04-28 21:27   ` Nafiz Islam
2024-04-30 12:32     ` Ihor Radchenko
2024-04-30 19:45       ` Nafiz Islam
2024-05-01 11:11         ` Ihor Radchenko
2024-05-01 12:02           ` Nafiz Islam
2024-05-01 13:50             ` Ihor Radchenko
2024-05-01 23:03               ` Nafiz Islam
2024-05-02 12:34                 ` Ihor Radchenko
     [not found]                   ` <CAKjtFcT0B_CiZ=Gm4WL1Qj-TkzQ1qg+ebcVqdu-4_kzu_OEFcA@mail.gmail.com>
2024-05-02 20:57                     ` Nafiz Islam
2024-05-03 11:08                       ` Ihor Radchenko
2024-05-04  0:10                         ` Nafiz Islam
2024-05-04 12:08                           ` Ihor Radchenko
2024-05-11 16:02                             ` Nafiz Islam
2024-05-11 17:41                               ` Ihor Radchenko [this message]
2024-04-30 12:33   ` Ihor Radchenko

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=87wmo0tff0.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=nafiz.islam1001@gmail.com \
    /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).