84 lines
2.9 KiB
Org Mode
84 lines
2.9 KiB
Org Mode
:PROPERTIES:
|
|
:roam_refs: https://systemcrafters.net/build-a-second-brain-in-emacs/5-org-roam-hacks/
|
|
:ID: 20210916T194849.283036
|
|
:END:
|
|
#+title: 5 Org Roam Hacks for Better Productivity in Emacs - System Crafters
|
|
#+category: org-roam-hacks
|
|
#+filetags: :Project:Archive:CCE:
|
|
|
|
#+ARCOLOGY_KEY: cce/systemcrafters-org-roam-hacks
|
|
#+ARCOLOGY_ALLOW_CRAWL: t
|
|
|
|
[[file:archive.org][Archive]]
|
|
|
|
This set of [[id:cce/org-roam][org-roam]] hacks largely map to things that are already in my [[id:cce/cce][CCE]] systems.
|
|
|
|
- [[id:cce/dynamic_agendas][Dynamic and fast agenda]] which is a bit different but I prefer my version.
|
|
This includes a function [[help:cce/org-roam-files-with-tags][cce/org-roam-files-with-tags]] which is quite useful as a general org-roam "API".
|
|
|
|
* Capturing tasks directly in to projects
|
|
:PROPERTIES:
|
|
:ID: 20210916T201004.209834
|
|
:END:
|
|
|
|
This is a stroke of genious:
|
|
|
|
#+BEGIN_QUOTE
|
|
(org-roam-capture- :node (org-roam-node-read
|
|
nil
|
|
(my/org-roam-filter-by-tag "Project"))
|
|
#+END_QUOTE
|
|
|
|
#+begin_src emacs-lisp
|
|
(defun cce/org-roam-capture-to-project ()
|
|
(interactive)
|
|
(org-roam-capture- :node (org-roam-node-read
|
|
nil
|
|
(lambda (node)
|
|
(-contains? (org-roam-node-tags node) "Project")))
|
|
:templates '(("p" "project" plain "* NEXT %?"
|
|
:if-new (file+head+olp "%<%Y%m%d%H%M%S>-${slug}.org"
|
|
"#+title: ${title}\n#+category: ${title}\n#+filetags: Project"
|
|
("Tasks"))))))
|
|
#+end_src
|
|
|
|
* NEXT automatically copy or move completed tasks to dailies
|
|
|
|
this is interesting............
|
|
|
|
* Finding nodes which are attached to a tag
|
|
:PROPERTIES:
|
|
:ID: 20210916T195345.631500
|
|
:END:
|
|
|
|
This is analogous to [[id:cce/navigate-note][Navigating notes by relations]] but for Tags.
|
|
|
|
#+begin_src emacs-lisp
|
|
(defun cce/org-roam-find-by-tag (tag)
|
|
"select a node from a list filtered by TAG, creating it if necessary."
|
|
(interactive
|
|
(list (completing-read "Tag: " (-map (lambda (row) (car row))
|
|
(org-roam-db-query [:select tag :from tags
|
|
:group-by tag])))))
|
|
(org-roam-node-find
|
|
nil
|
|
nil
|
|
(lambda (node)
|
|
(-contains? (org-roam-node-tags node) tag))))
|
|
#+end_src
|
|
|
|
** NEXT provide a template to the finder which sets the =FILETAGS=
|
|
|
|
* Make it an [[id:arroyo/emacs][Arroyo Emacs]] module
|
|
|
|
#+PROPERTY: header-args:emacs-lisp :tangle org-roam-hacks.el
|
|
#+ARROYO_EMACS_MODULE: org-roam-hacks
|
|
#+ARROYO_MODULE_WANTS: cce/org-roam.org
|
|
|
|
#+begin_src emacs-lisp
|
|
(bind-keys :map #'org-roam-prefix-map
|
|
("t" . cce/org-roam-find-by-tag)
|
|
("cp" . cce/org-roam-capture-to-project))
|
|
(provide 'cce/org-roam-hacks)
|
|
#+end_src
|