mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
(feat)capture: add org-roam-post-node-insert-hook (#2125)
* (feat): add org-roam-post-node-insert-hook Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
This commit is contained in:
@ -744,12 +744,17 @@ This function is to be called in the Org-capture finalization process."
|
||||
(delete-region (car region) (cdr region))
|
||||
(set-marker (car region) nil)
|
||||
(set-marker (cdr region) nil))
|
||||
(let ((link (org-link-make-string (concat "id:" (org-roam-capture--get :id))
|
||||
(org-roam-capture--get :link-description))))
|
||||
(let* ((id (org-roam-capture--get :id))
|
||||
(description (org-roam-capture--get :link-description))
|
||||
(link (org-link-make-string (concat "id:" id)
|
||||
description)))
|
||||
(if (eq (point) (marker-position mkr))
|
||||
(insert link)
|
||||
(org-with-point-at mkr
|
||||
(insert link)))))))
|
||||
(insert link)))
|
||||
(run-hook-with-args 'org-roam-post-node-insert-hook
|
||||
id
|
||||
description)))))
|
||||
|
||||
;;;; Processing of the capture templates
|
||||
(defun org-roam-capture--fill-template (template &optional ensure-newline)
|
||||
|
@ -688,9 +688,13 @@ The INFO, if provided, is passed to the underlying `org-roam-capture-'."
|
||||
(delete-region beg end)
|
||||
(set-marker beg nil)
|
||||
(set-marker end nil))
|
||||
(insert (org-link-make-string
|
||||
(concat "id:" (org-roam-node-id node))
|
||||
description)))
|
||||
(let ((id (org-roam-node-id node)))
|
||||
(insert (org-link-make-string
|
||||
(concat "id:" id)
|
||||
description))
|
||||
(run-hook-with-args 'org-roam-post-node-insert-hook
|
||||
id
|
||||
description)))
|
||||
(org-roam-capture-
|
||||
:node node
|
||||
:info info
|
||||
|
@ -122,6 +122,12 @@ All Org files, at any level of nesting, are considered part of the Org-roam."
|
||||
:group 'org-roam
|
||||
:type 'hook)
|
||||
|
||||
(defcustom org-roam-post-node-insert-hook nil
|
||||
"Hook run when an Org-roam node is inserted as an Org link.
|
||||
Each function takes two arguments: the id of the node, and the link description."
|
||||
:group 'org-roam
|
||||
:type 'hook)
|
||||
|
||||
(defcustom org-roam-file-extensions '("org")
|
||||
"List of file extensions to be included by Org-Roam.
|
||||
While a file extension different from \".org\" may be used, the
|
||||
|
Reference in New Issue
Block a user