complete-computing-environment/extracting_org_roam_heading...

1.1 KiB

Extracting Org Roam Headings

Call this function cce/org-roam-extract within an org-mode heading to extract that text to a new org-roam buffer. It uses the title as a default and inserts a link to the buffer on completion using the org-roam capture systems

(defun cce/org-roam-extract ()
  "extract heading under point to a new org-roam file"
  (interactive)
  (outline-mark-subtree)
  (let ((title (elt (org-heading-components) 4)))
    (kill-region (mark) (point))
    (insert "- ")
    (org-roam-insert nil (list title))
    (goto-char (point-min))
    (yank)
    (kill-whole-line)))
(provide 'cce/org-roam-extract)