Clear the org-capture context in case it is initialised during note extraction

This commit is contained in:
Chris Barrett
2022-08-18 11:33:04 +12:00
parent 68f34a9116
commit 49b936204b

View File

@@ -248,20 +248,25 @@ handles file titles, tags and transclusions better."
(org-roam-db-update-file) (org-roam-db-update-file)
(let* ((template-info nil) (let* ((template-info nil)
(node (org-roam-node-at-point)) (node (org-roam-node-at-point))
(template (org-roam-format-template (template
(string-trim (org-capture-fill-template org-roam-extract-new-file-path)) (unwind-protect
(lambda (key default-val) (progn
(let ((fn (intern key)) (setq org-capture-plist nil)
(node-fn (intern (concat "org-roam-node-" key))) (org-roam-format-template
(ksym (intern (concat ":" key)))) (string-trim (org-capture-fill-template org-roam-extract-new-file-path))
(cond (lambda (key default-val)
((fboundp fn) (let ((fn (intern key))
(funcall fn node)) (node-fn (intern (concat "org-roam-node-" key)))
((fboundp node-fn) (ksym (intern (concat ":" key))))
(funcall node-fn node)) (cond
(t (let ((r (read-from-minibuffer (format "%s: " key) default-val))) ((fboundp fn)
(plist-put template-info ksym r) (funcall fn node))
r))))))) ((fboundp node-fn)
(funcall node-fn node))
(t (let ((r (read-from-minibuffer (format "%s: " key) default-val)))
(plist-put template-info ksym r)
r)))))))
(setq org-capture-plist nil)))
(relpath (file-name-as-directory org-roam-directory)) (relpath (file-name-as-directory org-roam-directory))
(file-path (expand-file-name (file-path (expand-file-name
(if org-roam-rewrite-confirm-extraction-path-p (if org-roam-rewrite-confirm-extraction-path-p