progfolio / doct

DOCT: Declarative Org Capture Templates for Emacs
GNU General Public License v3.0
380 stars 8 forks source link

How to use "doct-add-to"? #38

Closed Ypot closed 1 year ago

Ypot commented 1 year ago

I would like to add a doct template, to my existing list of templates. I get errors, could it be possible to have a little help? This is my code:

(setopt org-capture-templates
(doct-add-to org-capture-templates
         `("Proyecto" :keys "y"
           :type entry
               :id "2023-02-09T12:06:10,23"
               :prepend t
           :immediate-finish t
           :jump-to-captured t
           :hook
               ,(defun +org-capture-captialize-dir-prop ()
                  (save-excursion
                    (goto-char (point-min))
                    (when (re-search-forward "^:DIR:" nil t)
                      (upcase-region (line-beginning-position) (line-end-position)))))         
           :template ("* PROY %^{CLIENTE} _%^{OT}_ /%^{Descripción}/
:PROPERTIES:
:DIR: z:/! 2023/COMERCIAL/OFERTAS/%\\1-%\\2-%\\3
:END:
** Gestión del Proyecto
*** Contacto
*** Datos de partida
*** Reunión %\\1
*** SIG. Ofertar
*** T-AD Facturar")
           'append)))

Error message:


condition-case: DOCT Wrong type argument: (doct--plist-p), (properties (:keys "y" :type entry :id "2023-02-09T12:06:10,23" :prepend t :immediate-finish t :jump-to-captured t :hook +org-capture-captialize-dir-prop :template ("* PROY %^{CLIENTE} _%^{OT}_ /%^{Descripción}/
:PROPERTIES:
:DIR: z:/! 2023/COMERCIAL/OFERTAS/%\\1-%\\2-%\\3
:END:
** Gestión del Proyecto
*** Contacto
*** Datos de partida
*** Reunión %\\1
*** SIG. Ofertar
*** T-AD Facturar") 'append)), ("Proyecto" :keys "y" :type entry :id "2023-02-09T12:06:10,23" :prepend t :immediate-finish t :jump-to-captured t :hook +org-capture-captialize-dir-prop :template ("* PROY %^{CLIENTE} _%^{OT}_ /%^{Descripción}/
:PROPERTIES:
:DIR: z:/! 2023/COMERCIAL/OFERTAS/%\\1-%\\2-%\\3
:END:
** Gestión del Proyecto
*** Contacto
*** Datos de partida
*** Reunión %\\1
*** SIG. Ofertar
*** T-AD Facturar") 'append)
progfolio commented 1 year ago

You have a misplaced parenthesis.

(require 'org-capture)
(let ((org-capture-templates nil))
  (doct-add-to org-capture-templates
               `("Proyecto" :keys "y"
                 :type entry
                 :id "2023-02-09T12:06:10,23"
                 :prepend t
                 :immediate-finish t
                 :jump-to-captured t
                 :hook
                 ,(defun +org-capture-captialize-dir-prop ()
                    (save-excursion
                      (goto-char (point-min))
                      (when (re-search-forward "^:DIR:" nil t)
                        (upcase-region (line-beginning-position) (line-end-position)))))
                 :template ("* PROY %^{CLIENTE} _%^{OT}_ /%^{Descripción}/
:PROPERTIES:
:DIR: z:/! 2023/COMERCIAL/OFERTAS/%\\1-%\\2-%\\3
:END:
** Gestión del Proyecto
*** Contacto
*** Datos de partida
*** Reunión %\\1
*** SIG. Ofertar
*** T-AD Facturar"))
               'append))

Returns:

(("y" "Proyecto" entry (id "2023-02-09T12:06:10,23")
  "* PROY %^{CLIENTE} _%^{OT}_ /%^{Descripción}/\n:PROPERTIES:\n:DIR: z:/! 2023/COMERCIAL/OFERTAS/%\\1-%\\2-%\\3\n:END:\n** Gestión del Proyecto\n*** Contacto\n*** Datos de partida\n*** Reunión %\\1\n*** SIG. Ofertar\n*** T-AD Facturar"
  :immediate-finish t :jump-to-captured t :prepend t :doct
  (:doct-name "Proyecto" :keys "y" :type entry :id "2023-02-09T12:06:10,23"
              :prepend t :immediate-finish t :jump-to-captured t :hook
              +org-capture-captialize-dir-prop :template
              ("* PROY %^{CLIENTE} _%^{OT}_ /%^{Descripción}/\n:PROPERTIES:\n:DIR: z:/! 2023/COMERCIAL/OFERTAS/%\\1-%\\2-%\\3\n:END:\n** Gestión del Proyecto\n*** Contacto\n*** Datos de partida\n*** Reunión %\\1\n*** SIG. Ofertar\n*** T-AD Facturar"))))

as expected.