emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [PATCH] function and symbol for headline and olp for org-capture-tem


From: Nafiz Islam
Subject: Re: [PATCH] function and symbol for headline and olp for org-capture-templates
Date: Sun, 9 Jun 2024 10:59:06 -0400
User-agent: Mozilla Thunderbird

I tried to run make test with your patch, and it is failing:

On my side it passes on main branch at commit 
6c862699a6db3f6b76391c05380d92d9f1b3838f with patch.
   passed   444/1207  test-org-capture/entry (0.099791 sec)
   ...
   passed   447/1207  test-org-capture/org-capture-expand-olp (0.001104 sec)

Apparently, you get
`"* A\n** B\n*** 1970\n**** 1970-01 January\n***** 1970-01-01 Thursday\n****** H1 
Capture text\n** C\n"'

Whereas I get the expected result of
`"* A\n** B\n*** 1969\n**** 1969-12 December\n***** 1969-12-31 Wednesday\n****** H1 
Capture text\n** C\n"'

What do you get if you evaluate `(calendar-gregorian-from-absolute 
(time-to-days 0))'? I get `(12 31 1969)'.
I set `org-overriding-default-time' to `0' for testing with datetree.

I don't have to additionally test for whether the lambda (as a target) is actually called while visiting the file right?
May you elaborate what you mean?

So I've written a test for lambda-based target.

(should
   (equal
    "* A\n* B\n** H1 Capture text\n* C\n"
    (org-test-with-temp-text-in-file "* A\n* B\n* C\n"
      (let* ((file (buffer-file-name))
             (org-capture-templates
              `(("t" "Todo" entry (file+headline ,file ,(lambda () "B")) "** H1 
%?"))))
        (org-capture nil "t")
        (insert "Capture text")
        (org-capture-finalize))
      (buffer-string))))

But it does not verify that the lambda `(lambda () "B")' is actually being 
called while
visiting the file which would allow reading the file to compute or generate a 
headline.
So I'm wondering if I should write a test for that too. Maybe for each new 
lambda target?




reply via email to

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