Skip to content
Snippets Groups Projects
Commit d58a3608 authored by Tim van Deurzen's avatar Tim van Deurzen
Browse files

Got project finding and capturing working as intended.

parent dac8005c
No related branches found
No related tags found
No related merge requests found
......@@ -112,37 +112,31 @@
(setq org-roam-directory "~/org/roam/"
org-roam-v2-ack t)
;; (setq org-roam-dailies-capture-templates)
(setq deft-directory "~/org/roam")
(setq deft-extensions '("org"))
(org-roam-db-autosync-mode))
(defun tim/capture-project ()
"Select or capture project within a particular workspace."
(require 'vulpea-select)
(defun tim/find-project ()
"Select or capture project within a particular."
(interactive)
(let* ((workspace (completing-read "workspace: " (tim/org-roam-workspaces)))
(workspace-path (expand-file-name workspace org-roam-directory))
(template-path (format "%s/templates/" workspace-path))
(node-path-format (concat workspace-path "/%<%Y%m%d%H%M%S>-${slug}.org")))
(org-roam-capture- :node (org-roam-node-read nil (tim/org-roam-filter-by-tag workspace))
:templates
`(
("p" "project" plain (file ,(concat template-path "project.org"))
:if-new (file+head
,node-path-format
"#+title: ${title}")
:unnarrowed t)
("m" "monthly report" plain (file ,(concat template-path "monthly-report.org"))
:if-new (file+head
,(concat workspace-path "/%<%Y-%m>-report.org")
"#+title: %<%B %Y> report")
:unnarrowed t)
(let* ((workspace (completing-read "workspace: " (tim/org-roam-workspaces)))
(org-roam-directory (expand-file-name workspace org-roam-directory))
(node (vulpea-select-from "project: " (vulpea-db-query-by-tags-every (list workspace "project")))))
))))
(if (vulpea-note-id node)
(org-roam-node-visit (org-roam-node-from-id (vulpea-note-id node)))
(org-roam-capture- :node (org-roam-node-create :title (vulpea-note-title node))
:props '(:finalize find-file)
:templates
`(("p" "project" plain (file ,(concat org-roam-directory "/templates/project.org"))
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}")
:unnarrowed t))))))
;; TODO Create something similar to vulpea-find by first querying for the node and running org-roam-capture- if nothing is found.
(defun tim/capture-report ()
......@@ -164,9 +158,8 @@
;; TODO Use vulpea-select-from to find the right node, extended with the workspace, and open it if the filter matches.
(require 'vulpea-select)
(vulpea-select-from "report" (vulpea-db-query-by-tags-every (list "report")))
(vulpea-db-qu)
;; (vulpea-select-from "report" (vulpea-db-query-by-tags-every (list "report")))
;; (vulpea-db-qu)
(defun tim/org-roam-filter-by-tag (tag)
"Return a lambda to select nodes with a particular tag TAG."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment