Nicolas Goaziou <m...@nicolasgoaziou.fr> writes: > I think there should be a direct mapping between Customize interface and > values. Adding this macro as a band-aid to simply configuration is not, > IMO, a solution.
I think that current customize interface for org-capture-template is perfectly fine. doct aids users who set org-capture-templates programatically. doct also does not break the mapping between customize and the values - it converts the doct syntax into the default org-capture-template format + adds a number of shorthands for capture-related hooks + to capture contexts + provides easier definition of similar templates (via inheritance). For example the below doct definition provides two similar templates without a need to duplicate them: (defcustom org-capture-ref-capture-template `( :group "org-capture-ref template" :type entry ,@org-capture-ref-capture-target :fetch-bibtex (lambda () (org-capture-ref-process-capture)) ; this must run first :link-type (lambda () (org-capture-ref-get-bibtex-field :type)) :extra (lambda () (if (org-capture-ref-get-bibtex-field :journal) (s-join "\n" '("- [ ] [[elisp:(browse-url (url-encode-url (format \"https://sci-hub.se/%s\" (org-entry-get nil \"DOI\"))))][downlaod and attach pdf]]" "- [ ] [[elisp:org-attach-open][read paper capturing interesting references]]" "- [ ] [[elisp:(browse-url (url-encode-url (format \"https://www.semanticscholar.org/search?q=%s\" (org-entry-get nil \"TITLE\"))))][check citing articles]]" "- [ ] [[elisp:(browse-url (url-encode-url (format \"https://www.connectedpapers.com/search?q=%s\" (org-entry-get nil \"TITLE\"))))][check related articles]]" "- [ ] check if bibtex entry has missing fields" "- [ ] Consider subscribing to new citations")) "")) :org-entry (lambda () (org-capture-ref-get-org-entry)) :template ("%{fetch-bibtex}* TODO %?%{space}%{org-entry}" "%{extra}") :children (("Interactive org-capture-ref template" :keys ,(car org-capture-ref-capture-keys) :space " ") ("Silent org-capture-ref template" :keys ,(cadr org-capture-ref-capture-keys) :space "" :immediate-finish t))) "Default capture template. The template is a template defined using `doct' syntax. See docstring of `doct' for details." :type 'list :group 'org-capture-ref) > If capture templates values are too complicated, what about simplifying > them, and possibly use this macro as a temporary solution to help > transition? Could you elaborate what you are referring to? doct is a simplification of otherwise more complex templates. Without doct, users may need to write addition Elisp to define complex templates. With doct, a number of things can be done in a more compact form. A bright example is defining a capture hook that will only be activated for a specific template. doct allows to do it seamlessly, while vanilla syntax will require user to set the hook manually and check the current active template via elisp in a non-obvious ways that require knowing org-capture internals. Best, Ihor