Add function to refile to org-roam node

master
Jacopo De Simoi 1 year ago
parent b3d36eb2bc
commit 0ffccbe68d
  1. 2
      custom.el
  2. 58
      global.org

@ -90,7 +90,7 @@
("melpa-stable" . "http://stable.melpa.org/packages/")
("org" . "http://orgmode.org/elpa/")))
'(package-selected-packages
'(monkeytype org-ql helm-xref slack treesit-auto org-roam elfeed jeison dired-du lua-mode geiser-guile adaptive-wrap excorporate helm-ag helm-projectile org-journal async with-editor treepy s popup epl pkg-info pcre2el dash f password-store hl-todo graphql ghub git-commit magit-popup flycheck helm-core git-gutter markdown-mode magit-todos aggressive-indent pass magit helm-flycheck helm))
'(magit magit-todos monkeytype org-ql helm-xref slack treesit-auto org-roam elfeed jeison dired-du lua-mode geiser-guile adaptive-wrap excorporate helm-ag helm-projectile org-journal async with-editor treepy s popup epl pkg-info pcre2el dash f password-store hl-todo graphql ghub git-commit flycheck helm-core git-gutter markdown-mode aggressive-indent pass helm-flycheck helm))
'(parens-require-spaces nil)
'(safe-local-variable-values
'((gac-automatically-push-p . t)

@ -2100,8 +2100,50 @@
(direction . bottom )
(window-width . fit-window-to-buffer)
(window-height . 0.40 )))
#+end_src
This snippet was taken from [[https://org-roam.discourse.group/t/creating-an-org-roam-note-from-an-existing-headline/978][this thread]], it allows to refile an
org-headline to a org-roam node.
#+begin_src emacs-lisp
(defun org-roam-create-note-from-headline ()
"Create an Org-roam note from the current headline if it doesn't
exist without jumping to it"
(let* ((title (nth 4 (org-heading-components)))
;; Read in the name of the node, with the title filled in
;; TODO: How can I just use the title without user input?
(node (org-roam-node-read title)))
;; Skip the node if it already exists
(if (org-roam-node-file node)
(message "Skipping %s, node already exists" title)
;; Without this the subsequent kills seem to be grouped together, not
;; sure why
(kill-new "")
;; Cut the subtree from the original file
(org-cut-subtree)
;; Create the new capture file
(org-roam-capture- :node node)
;; Paste in the subtree
(org-paste-subtree)
;; Removing the heading from new node
(kill-whole-line)
;; Finalizing the capture will save and close the capture buffer
(org-capture-finalize nil)
;; Because we've deleted a subtree, we need the following line to make the
;; `org-map-entries' call continue from the right place
(setq org-map-continue-from
(org-element-property :begin (org-element-at-point))))))
(defun org-roam-create-note-from-headlines ()
(interactive)
(if (region-active-p)
;; `region-start-level' means we'll map over only headlines that are at
;; the same level as the first headline in the region. This may or may not
;; be what you want
(org-map-entries
'org-roam-create-note-from-headline t 'region-start-level)
;; If no region was selected, just create the note from the current headline
(org-roam-create-note-from-headline)))
#+end_src
*** export to ics
#+begin_src emacs-lisp
(defun wilder/push-subtree-to-nextcloud ()
@ -2119,6 +2161,11 @@
(org-icalendar-export-to-ics))))
(widen))
#+end_src
*** org-babel
I thought that i had no reason to use it, but let's see
#+begin_src emacs-lisp
(org-babel-lob-ingest "~/work/include/latexmkrc-base.org")
#+end_src
*** Make reftex work in org-edit
RefTeχ refuses to work when the buffer is not visiting a file.
Here is a tentative workaround:
@ -2782,10 +2829,15 @@
#+end_src
* Specialties
** try and fix issue with static-if
#+begin_src emacs-lisp
(require 'compat)
#+end_src
** powerthesaurus
This is throwing an error (static-if)
#+begin_src emacs-lisp
(require 'powerthesaurus)
(global-set-key (kbd "C-<f14>") #'powerthesaurus-hydra/body)
(require 'powerthesaurus)
(global-set-key (kbd "C-<f14>") #'powerthesaurus-hydra/body)
#+end_src
** beacon

Loading…
Cancel
Save