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: Sat, 1 Jun 2024 12:38:31 -0400
User-agent: Mozilla Thunderbird

Craig Topham has cleared me to contribute to Emacs. I have attached the latest version of my patch.

> All you need to create a new symbol in local context is (let ((my-symbol
> value)) ...).

I don't think that will work because of lexical binding. For example:

(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 test-org-capture/entry/headline) "** H1 %?"))))
        (setq test-org-capture/entry/headline "B")
    (org-capture nil "t")
    (insert "Capture text")
    (org-capture-finalize)
        (makunbound 'test-org-capture/entry/headline))
      (buffer-string))))

In that code, if I decide to include `test-org-capture/entry/headline' in the `let' then the symbol would be `nil' during `org-capture' even if I initialize in the `let' or use `setq'.

I've been also considering testing if the lambda is actually visiting the target file when it is called, but that would mean 3 more tests: `headline', `olp' and `olp+datetree'. Curious to know if you believe that is worthwhile or not.

Attachment: 0001-function-and-symbol-for-headline-and-olp-for-org-cap.patch
Description: Text Data


reply via email to

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