From ba2f97ab31325c78373577e964641d88aebad027 Mon Sep 17 00:00:00 2001 From: Emmet Date: Tue, 16 Jul 2024 08:33:30 -0500 Subject: [PATCH] Select roam dashboard/inbox from title --- user/app/doom-emacs/config.el | 16 ++++++++++++---- user/app/doom-emacs/doom.org | 20 ++++++++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/user/app/doom-emacs/config.el b/user/app/doom-emacs/config.el index b03e110..ec2d418 100644 --- a/user/app/doom-emacs/config.el +++ b/user/app/doom-emacs/config.el @@ -727,8 +727,8 @@ If the path from LINK does not exist, nil is returned." (defun org-roam-open-dashboard () "Open ${org-roam-directory}/dashboard.org (I use this naming convention to create dashboards for each of my org roam maps)" (interactive) - (if (file-exists-p (concat org-roam-directory "/dashboard.org")) - (org-open-file (concat org-roam-directory "/dashboard.org")) + (if (org-roam-node-from-title-or-alias "Overview") + (org-roam-node-open (org-roam-node-from-title-or-alias "Overview")) (dired org-roam-directory)) ) @@ -740,11 +740,19 @@ If the path from LINK does not exist, nil is returned." (message "No inbox found, capture something with M-x org-roam-capture-inbox")) ) +(defun org-roam-open-inbox () + "Open ${org-roam-directory}/dashboard.org (I use this naming convention to create dashboards for each of my org roam maps)" + (interactive) + (if (org-roam-node-from-title-or-alias "Inbox") + (org-roam-node-open (org-roam-node-from-title-or-alias "Inbox")) + (message "No inbox found, capture something with M-x org-roam-capture-inbox")) +) + (defun org-roam-capture-inbox () (interactive) - (org-roam-capture- :node (org-roam-node-create) + (org-roam-capture- :node (org-roam-node-from-title-or-alias "Inbox") :templates '(("i" "inbox" plain "* %?" - :if-new (file+head "inbox.org" "#+title: Inbox\n"))))) + :if-new (file+head "%<%Y%m%d%H%M%S>-inbox.org" "#+title: Inbox\n"))))) (defun org-roam-switch-db (&optional arg silent) "Switch to a different org-roam database, arg" diff --git a/user/app/doom-emacs/doom.org b/user/app/doom-emacs/doom.org index eb51346..bb2b94a 100644 --- a/user/app/doom-emacs/doom.org +++ b/user/app/doom-emacs/doom.org @@ -866,8 +866,8 @@ exit (defun org-roam-open-dashboard () "Open ${org-roam-directory}/dashboard.org (I use this naming convention to create dashboards for each of my org roam maps)" (interactive) - (if (file-exists-p (concat org-roam-directory "/dashboard.org")) - (org-open-file (concat org-roam-directory "/dashboard.org")) + (if (org-roam-node-from-title-or-alias "Overview") + (org-roam-node-open (org-roam-node-from-title-or-alias "Overview")) (dired org-roam-directory)) ) @@ -879,11 +879,19 @@ exit (message "No inbox found, capture something with M-x org-roam-capture-inbox")) ) +(defun org-roam-open-inbox () + "Open ${org-roam-directory}/dashboard.org (I use this naming convention to create dashboards for each of my org roam maps)" + (interactive) + (if (org-roam-node-from-title-or-alias "Inbox") + (org-roam-node-open (org-roam-node-from-title-or-alias "Inbox")) + (message "No inbox found, capture something with M-x org-roam-capture-inbox")) +) + (defun org-roam-capture-inbox () (interactive) - (org-roam-capture- :node (org-roam-node-create) + (org-roam-capture- :node (org-roam-node-from-title-or-alias "Inbox") :templates '(("i" "inbox" plain "* %?" - :if-new (file+head "inbox.org" "#+title: Inbox\n"))))) + :if-new (file+head "%<%Y%m%d%H%M%S>-inbox.org" "#+title: Inbox\n"))))) (defun org-roam-switch-db (&optional arg silent) "Switch to a different org-roam database, arg" @@ -932,6 +940,10 @@ exit (org-roam-switch-db prev-org-roam-db-choice 1))) #+END_SRC + +#+RESULTS: +: org-roam-switch-db-id-open + *** Org Roam "todos" Tagging for Org Agenda #+BEGIN_SRC emacs-lisp :tangle config.el ;;;------ Org-roam-agenda configuration ------;;;