tweaking various org things

This commit is contained in:
Chris Cochrun 2023-08-30 10:26:49 -05:00
parent ff163c2660
commit b8ee1a7d80
2 changed files with 48 additions and 2 deletions

View file

@ -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

25
init.el
View file

@ -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