diff --git a/README.org b/README.org index 21788b3d..7867253e 100644 --- a/README.org +++ b/README.org @@ -1082,7 +1082,8 @@ We also need to setup some capture templates to use some specific setups with my "Create an org roam node underneath this org node" (interactive) (+org/insert-item-below 1) - (org-id-get-create)) + (org-id-get-create) + (org-roam-alias-add)) (defun chris/org-roam-node-id-create () "Make the basic org node and org roam one by adding an id and creating an alias" (interactive) @@ -1107,6 +1108,28 @@ We also need to setup some capture templates to use some specific setups with my (interactive) (chris/consult-ripgrep-files-with-matches org-roam-directory)) + +(defun chris/org-roam-refile-node-to-file () + "Take the node at point and refile it into a new org roam file" + (interactive) + (if (org-before-first-heading-p) + (message "Not in or on an org heading") + (save-excursion + ;; If inside heading contents, move the point back to the heading + ;; otherwise `org-agenda-get-some-entry-text' won't work. + (unless (org-on-heading-p) (org-previous-visible-heading 1)) + (let ((heading (substring-no-properties (thing-at-point 'line))) + (contents (substring-no-properties + (org-agenda-get-some-entry-text + (point-marker) + most-positive-fixnum))) + (node (concat heading contents))) + (message "Copied: %s" heading) + (kill-new node) + (org-roam-node-find) + (delete-line) + (newline) + (yank))))) (org-roam-setup) :general diff --git a/init.el b/init.el index 2223d430..ab035d21 100644 --- a/init.el +++ b/init.el @@ -789,7 +789,8 @@ much faster. The hope is to also make this a faster version of imenu." "Create an org roam node underneath this org node" (interactive) (+org/insert-item-below 1) - (org-id-get-create)) + (org-id-get-create) + (org-roam-alias-add)) (defun chris/org-roam-node-id-create () "Make the basic org node and org roam one by adding an id and creating an alias" (interactive) @@ -814,6 +815,28 @@ much faster. The hope is to also make this a faster version of imenu." (interactive) (chris/consult-ripgrep-files-with-matches org-roam-directory)) + +(defun chris/org-roam-refile-node-to-file () + "Take the node at point and refile it into a new org roam file" + (interactive) + (if (org-before-first-heading-p) + (message "Not in or on an org heading") + (save-excursion + ;; If inside heading contents, move the point back to the heading + ;; otherwise `org-agenda-get-some-entry-text' won't work. + (unless (org-on-heading-p) (org-previous-visible-heading 1)) + (let ((heading (substring-no-properties (thing-at-point 'line))) + (contents (substring-no-properties + (org-agenda-get-some-entry-text + (point-marker) + most-positive-fixnum))) + (node (concat heading contents))) + (message "Copied: %s" heading) + (kill-new node) + (org-roam-node-find) + (delete-line) + (newline) + (yank))))) (org-roam-setup) :general