31 lines
1.1 KiB
Org Mode
31 lines
1.1 KiB
Org Mode
:PROPERTIES:
|
|
:ID: cce/extracting_org_roam_headings
|
|
:END:
|
|
#+TITLE: Extracting Org Roam Headings
|
|
#+PROPERTY: header-args :mkdirp yes :results none
|
|
#+PROPERTY: header-args:emacs-lisp :tangle org-roam-extract.el
|
|
#+filetags: :CCE:
|
|
|
|
#+ARCOLOGY_KEY: cce/org-roam-extract
|
|
#+ARCOLOGY_ALLOW_CRAWL: t
|
|
|
|
#+ARROYO_EMACS_MODULE: org-roam-extract
|
|
#+ARROYO_MODULE_WANTS: cce/org-roam.org
|
|
|
|
Call this function =cce/org-roam-extract= within an [[id:1fb8fb45-fac5-4449-a347-d55118bb377e][org-mode]] heading to extract that text to a new [[id:cce/org-roam][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
|
|
|
|
#+begin_src emacs-lisp
|
|
(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)
|
|
#+end_src
|