Max Nikulin <[email protected]> writes:
> On 10/03/2022 19:53, Ignacio Casso wrote:
>> For example, if we call this:
>> (let ((org-capture-templates
>> '(("d" "default" entry
>> (file+headline org-default-notes-file "Tasks")
>> "* %?"))))
>> (org-capture nil "d")))
>> It produces the error:
>> (error "No capture template referred to by \"d\" keys")
>
> Ignacio, could you, please, try the following?
>
> (custom-set-variables
> '(org-capture-templates
> '(("d" "default" entry
> (file "/tmp/capture-test.org")
> "* %?"))))
> (org-capture nil "d")
>
That works, of course, but it's not suitable to my use case. The example
I have provided has been reduced from a larger function I wrote that
relies on org-capture functionality to create new entries in an org
file, using a template specific for that function which is not relevant
for any other Elisp code calling org-capture. Thus the function binds
locally and temporarily org-capture-templates, as I've seen other Elisp
code snippets do. If org-capture is already loaded it works just fine,
and I would expect it to work too when it is not and the function
triggers the autoload, but it doesn't.