Hello, I think I've found a bug with org-capture autoload. If the first time you use org-capture before it's actually loaded is within a let form binding org-capture-templates, it produces an error saying that the template was not found.
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") Furthermore, depending on where that form was evaluated or defined, the next time you called org-capture may work or produce the following error: org-capture: Symbol’s value as variable is void: org-capture-templates In particular, if it is evaluated directly in the scratch buffer the next call to org-capture works, and if it is part of a function defined in my init file and evaluated in the scratch buffer, it produces the error. I have tried this too in Emacs 29 and the behaviour is similar, but sometimes the error produced is (error "Defining as dynamic an already lexical var") instead of (error "No capture template referred to by \"d\" keys") This again depends on where the form is evaluated or defined. Best regards, Ignacio P.S., I now this has an easy solution: not autoloading org-capture and having (require 'org-capture) in my config. I'm just reporting the bug, if that is what this is. Emacs : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20) of 2022-01-16 Package: Org mode version 9.5.2 (9.5.2-gfbff08 @ /home/ignacio/.emacs.d/elpa/org-9.5.2/)