aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-11 15:46:15 -0500
committerCraig Jennings <c@cjennings.net>2026-07-11 15:46:15 -0500
commit07b832991621cff19487a8a5f6c54e63744c0cc5 (patch)
treea6d88920923c5a041423f4458d022924e51d0514
parente52668985817b92f296606707694729b866e8364 (diff)
downloaddotemacs-07b832991621cff19487a8a5f6c54e63744c0cc5.tar.gz
dotemacs-07b832991621cff19487a8a5f6c54e63744c0cc5.zip
fix(org-roam): resolve void find-node bindings, drop dead config
C-c n p and C-c n w were bound to cj/org-roam-find-node-project and -webclip, which no use-package :bind autoload could fulfill (they point at org-roam, which defines neither), so both keys errored with "autoloading failed to define function". I defined find-node-project as a sibling of find-node-topic/recipe against the existing project.org template, and dropped the webclip binding and label since no webclip template or flow exists. I repointed the v2mom/recipe/topic capture templates from .emacs.d/org-roam-templates/ to roam-dir/templates/ so one canonical directory feeds both the capture templates and the find-node commands. They had drifted, and edits to one copy never reached the other. Deleted the now-redundant .emacs.d/org-roam-templates/ files. I removed the 28-line commented consult-org-roam block. Its proposed C-c n l / C-c n r collide with live bindings, so it couldn't ship as written. Git keeps the draft.
-rw-r--r--modules/org-roam-config.el46
-rw-r--r--org-roam-templates/recipe.org17
-rw-r--r--org-roam-templates/topic.org7
-rw-r--r--org-roam-templates/v2mom.org40
-rw-r--r--tests/test-org-roam-config-tag-and-find.el11
5 files changed, 21 insertions, 100 deletions
diff --git a/modules/org-roam-config.el b/modules/org-roam-config.el
index eca867df..4e360bd7 100644
--- a/modules/org-roam-config.el
+++ b/modules/org-roam-config.el
@@ -77,25 +77,23 @@ FILETAGS and TITLE must sit on separate lines so Org parses the
:unnarrowed t)
("v" "v2mom" plain
- (file ,(concat user-emacs-directory "org-roam-templates/v2mom.org"))
+ (file ,(concat roam-dir "templates/v2mom.org"))
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "")
:unnarrowed t)
("r" "recipe" plain
- (file ,(concat user-emacs-directory "org-roam-templates/recipe.org"))
+ (file ,(concat roam-dir "templates/recipe.org"))
:if-new (file+head "recipes/%<%Y%m%d%H%M%S>-${slug}.org" "")
:unnarrowed t)
("t" "topic" plain
- (file ,(concat user-emacs-directory "org-roam-templates/topic.org"))
+ (file ,(concat roam-dir "templates/topic.org"))
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "")
:unnarrowed t)))
:bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
- ("C-c n p" . cj/org-roam-find-node-project)
("C-c n i" . org-roam-node-insert)
- ("C-c n w" . cj/org-roam-find-node-webclip)
:map org-mode-map
("C-M-i" . completion-at-point))
:config
@@ -209,10 +207,17 @@ created in that subdirectory of `org-roam-directory'."
(interactive)
(cj/org-roam-find-node "Recipe" "r" (concat roam-dir "templates/recipe.org") "recipes/"))
+
+(defun cj/org-roam-find-node-project ()
+ "List nodes of type \"Project\" in completing read for selection or creation."
+ (interactive)
+ (cj/org-roam-find-node "Project" "p" (concat roam-dir "templates/project.org")))
+
;; Bound after their defuns (not in the use-package :bind) so the byte-compiler
;; doesn't see both a :bind autoload and the real defun as two definitions.
(keymap-global-set "C-c n r" #'cj/org-roam-find-node-recipe)
(keymap-global-set "C-c n t" #'cj/org-roam-find-node-topic)
+(keymap-global-set "C-c n p" #'cj/org-roam-find-node-project)
;; ---------------------- Org Capture After Finalize Hook ----------------------
@@ -394,36 +399,6 @@ cut stays undoable. A confirmation prompt guards large subtrees (see
(org-roam-db-sync)
(message "'%s' moved to a new org-roam node (%s)." title filename))))
-;; TASK: Need to decide keybindings before implementation and testing
-;; (use-package consult-org-roam
-;; :ensure t
-;; :after org-roam
-;; :init
-;; (require 'consult-org-roam)
-;; ;; Activate the minor mode
-;; (consult-org-roam-mode 1)
-;; :custom
-;; ;; Use `ripgrep' for searching with `consult-org-roam-search'
-;; (consult-org-roam-grep-func #'consult-ripgrep)
-;; ;; Configure a custom narrow key for `consult-buffer'
-;; (consult-org-roam-buffer-narrow-key ?r)
-;; ;; Display org-roam buffers right after non-org-roam buffers
-;; ;; in consult-buffer (and not down at the bottom)
-;; (consult-org-roam-buffer-after-buffers t)
-;; :config
-;; ;; Eventually suppress previewing for certain functions
-;; (consult-customize
-;; consult-org-roam-forward-links
-;; :preview-key "M-.")
-;; :bind
-;; ;; Define some convenient keybindings as an addition
-;; ("C-c n e" . consult-org-roam-file-find)
-;; ("C-c n b" . consult-org-roam-backlinks)
-;; ("C-c n B" . consult-org-roam-backlinks-recursive)
-;; ("C-c n l" . consult-org-roam-forward-links)
-;; ("C-c n r" . consult-org-roam-search))
-
-
;; which-key labels
(with-eval-after-load 'which-key
(which-key-add-key-based-replacements
@@ -434,7 +409,6 @@ cut stays undoable. A confirmation prompt guards large subtrees (see
"C-c n r" "roam find recipe"
"C-c n t" "roam find topic"
"C-c n i" "roam insert node"
- "C-c n w" "roam find webclip"
"C-c n I" "roam insert immediate"
"C-c n d" "roam dailies menu"))
diff --git a/org-roam-templates/recipe.org b/org-roam-templates/recipe.org
deleted file mode 100644
index ed395be1..00000000
--- a/org-roam-templates/recipe.org
+++ /dev/null
@@ -1,17 +0,0 @@
-#+TITLE: ${title}
-#+CATEGORY: ${title}
-#+FILETAGS: Recipe
-#+STARTUP: showall
-
-${title}
-
-* Mise En Place
-
-
-* Execution
-
-
-* Notes
-
-
-* Nutrition
diff --git a/org-roam-templates/topic.org b/org-roam-templates/topic.org
deleted file mode 100644
index 40a09f79..00000000
--- a/org-roam-templates/topic.org
+++ /dev/null
@@ -1,7 +0,0 @@
-#+TITLE: ${title}
-#+CATEGORY: ${title}
-#+FILETAGS: Topic
-
-* ${title}
-
-
diff --git a/org-roam-templates/v2mom.org b/org-roam-templates/v2mom.org
deleted file mode 100644
index 0316299d..00000000
--- a/org-roam-templates/v2mom.org
+++ /dev/null
@@ -1,40 +0,0 @@
-#+TITLE: ${title}
-#+CATEGORY: ${title}
-#+FILETAGS: V2MOM
-
-* Vision
-_What do you want to achieve?_
-
-
-* Values
-_What's important about it? What are the principles and beliefs that guide it?_
-
-1.
-2.
-3.
-
-* Methods
-_How will you get it done? What are the key initiatives and actions?_
-
-1.
-2.
-3.
-4.
-5.
-
-* Obstacles
-_What might prevent success? What challenges must be overcome?_
-
-1.
- - Mitigation:
-2.
- - Mitigation:
-3.
- - Mitigation:
-
-* Measures
-_How will you know when you've succeeded? What are the key metrics?_
-
-1.
-2.
-3.
diff --git a/tests/test-org-roam-config-tag-and-find.el b/tests/test-org-roam-config-tag-and-find.el
index f98d8af0..97a7a683 100644
--- a/tests/test-org-roam-config-tag-and-find.el
+++ b/tests/test-org-roam-config-tag-and-find.el
@@ -147,6 +147,17 @@
;; The 4th arg is the subdir
(should (equal (nth 3 args) "recipes/"))))
+(ert-deftest test-org-roam-find-node-project-delegates-to-find-node ()
+ "Normal: `find-node-project' uses Project tag, 'p' key, project.org template."
+ (let ((args nil))
+ (cl-letf (((symbol-function 'cj/org-roam-find-node)
+ (lambda (&rest a) (setq args a))))
+ (cj/org-roam-find-node-project))
+ (should (equal (car args) "Project"))
+ (should (equal (cadr args) "p"))
+ ;; The 3rd arg is the template file, under the canonical roam-dir/templates/.
+ (should (string-suffix-p "templates/project.org" (nth 2 args)))))
+
;;; cj/org-roam-node-insert-immediate
(ert-deftest test-org-roam-node-insert-immediate-rebinds-templates-and-calls-insert ()