(internal): remove with-template-error wrapper (#1004)

This has caused more confusion than it has helped.
This commit is contained in:
Jethro Kuan 2020-08-06 10:51:24 +08:00 committed by GitHub
parent da6fdd7542
commit 444eedc799
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 21 deletions

View file

@ -104,8 +104,7 @@ Template string :\n%v")
(org-roam-capture--info (list (cons 'time time)))
(org-roam-capture--context 'dailies))
(setq org-roam-capture-additional-template-props (list :finalize 'find-file))
(org-roam--with-template-error 'org-roam-dailies-capture-templates
(org-roam-capture--capture))))
(org-roam-capture--capture)))
(defun org-roam-dailies-today ()
"Create and find the daily note for today."

View file

@ -53,19 +53,6 @@ If FILE, set `org-roam-temp-file-name' to file and insert its contents."
(setq-local org-roam-file-name ,file))
,@body)))))
(defmacro org-roam--with-template-error (templates &rest body)
"Eval BODY, and point to TEMPLATES on error.
Provides more informative error messages so that users know where
to look.
\(fn TEMPLATES BODY...)"
(declare (debug (form body)) (indent 1))
`(condition-case err
,@body
(error (user-error "%s. Please adjust `%s'"
(error-message-string err)
,templates))))
(defun org-roam-message (format-string &rest args)
"Pass FORMAT-STRING and ARGS to `message' when `org-roam-verbose' is t."
(when org-roam-verbose

View file

@ -62,8 +62,7 @@ It opens or creates a note with the given ref.
(org-roam-capture--info decoded-alist)
(template (cdr (assoc 'template decoded-alist))))
(raise-frame)
(org-roam--with-template-error 'org-roam-capture-ref-templates
(org-roam-capture--capture nil template))
(org-roam-capture--capture nil template)
(org-roam-message "Item captured.")))
nil)

View file

@ -1588,8 +1588,7 @@ If NO-CONFIRM, assume that the user does not want to modify the initial prompt."
(slug . ,(funcall org-roam-title-to-slug-function title-with-tags))))
(org-roam-capture--context 'title))
(setq org-roam-capture-additional-template-props (list :finalize 'find-file))
(org-roam--with-template-error 'org-roam-capture-templates
(org-roam-capture--capture))))))
(org-roam-capture--capture)))))
;;;###autoload
(defun org-roam-find-directory ()
@ -1678,8 +1677,7 @@ If DESCRIPTION is provided, use this as the link label. See
:insert-at (point-marker)
:link-description link-description
:finalize 'insert-link))
(org-roam--with-template-error 'org-roam-capture-templates
(org-roam-capture--capture)))))
(org-roam-capture--capture))))
res))
(deactivate-mark)))