Skip to content

Commit

Permalink
(internal): remove with-template-error wrapper (org-roam#1004)
Browse files Browse the repository at this point in the history
This has caused more confusion than it has helped.
  • Loading branch information
jethrokuan authored Aug 6, 2020
1 parent da6fdd7 commit 444eedc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
3 changes: 1 addition & 2 deletions org-roam-dailies.el
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
13 changes: 0 additions & 13 deletions org-roam-macs.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions org-roam-protocol.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 2 additions & 4 deletions org-roam.el
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down Expand Up @@ -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)))

Expand Down

0 comments on commit 444eedc

Please sign in to comment.