From 5a28d75a20bc43c09e5d94d922121684e36770ea Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Wed, 20 Dec 2023 14:18:02 -0600 Subject: [PATCH] adding denote as a proper replacement to org-roam --- README.org | 30 ++++++++++++++++++++++-------- init.el | 30 ++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/README.org b/README.org index 2e327b76..efaff3e7 100644 --- a/README.org +++ b/README.org @@ -924,11 +924,17 @@ Part of this config includes some special capture templates for my work as a you (file "todo/notes.org") "* %u %?\n%i\n%a" :prepend t) ("p" "TFC Plan" entry - (function chris/org-roam-capture-lesson-file) + (function chris/denote-capture-lesson-file) (file ".templates/tfcplantemplate.org") :prepend nil :jump-to-captured t :empty-lines 1) + ("l" "TFC Lesson" plain + (function chris/org-caputre-denote-file-path) + (file ".templates/lessontemplate.org") + :prepend nil + :jump-to-captured t + :empyt-lines 1) ("P" "TFC Posts" entry (file+headline "nvtfc_social_media.org" "Posts") (file ".templates/posts.org") @@ -1153,14 +1159,24 @@ Part of this config includes some special capture templates for my work as a you We need to create a lesson capture function to find our lesson files differently each time we run our TFC plan capture. This is the most unique part of my capture template. This function uses =org-roam-node-read= to pick the lesson file that I need to add my lesson plan to. This way the lesson itself is created before the plan. #+begin_src emacs-lisp -(defun chris/org-roam-capture-lesson-file () +(defun chris/denote-capture-lesson-file () "Function to return the lesson file that is needed for TFC plan capture and move to correct position for plan insertion" (interactive) ;; (unless org-roam-mode (org-roam-mode +1)) - (let ((node (org-roam-node-read))) - (org-roam-node-visit node) + (let* ((files (denote-all-files)) + (lessons (remove nil + (cl-loop for file in files + collect (if (string-match "lessons/" file) file)))) + (lesson (completing-read "Select Lesson: " lessons nil nil '(".*_lesson" . 0)))) + (find-file lesson) (goto-char (point-min)) - (search-forward "PLAN"))) + (search-forward "* PLAN"))) + +(defun chris/org-caputre-denote-file-path () + "Function returning the file placement using denote for capture" + (interactive) + (denote-subdirectory) + (save-buffer)) #+end_src #+begin_src emacs-lisp @@ -5006,11 +5022,9 @@ MyBible is going to be set of functions for creating and using a bible app withi #+begin_src emacs-lisp (defvar bible-books '(genesis exodus leviticus numbers dueteronomy joshua judges ruth 1-samuel 2-samuel 1-kings 2-kings 1-chronicles 2-chronicles ezra nehemiah esther job psalms proverbs ecclesiastes song-of-solomon isaiah jeremiah lamentations ezekiel daniel hosea joel amos obadiah jonah micah nahum habakkuk zephaniah haggai zechariah malachi matthew mark luke john acts romans 1-corinthians 2-corinthians galatians ephesians phillipians colossians 1-thessalonians 2-thessalonians 1-timothy 2-timothy titus philemon hebrews james 1-peter 2-peter 1-john 2-john 3-john jude revelation)) -(org-list-get-subtree *genesis* idk) - (defun chris/find-verse () (interactive) - (find-file "/home/chris/docs/notes/bibles/esv.org") + (find-file "/home/chris/docs/bibles/esv.org") (list (imenu-choose-buffer-index))) #+end_src diff --git a/init.el b/init.el index 3b76499f..bef90eed 100644 --- a/init.el +++ b/init.el @@ -616,11 +616,17 @@ much faster. The hope is to also make this a faster version of imenu." (file "todo/notes.org") "* %u %?\n%i\n%a" :prepend t) ("p" "TFC Plan" entry - (function chris/org-roam-capture-lesson-file) + (function chris/denote-capture-lesson-file) (file ".templates/tfcplantemplate.org") :prepend nil :jump-to-captured t :empty-lines 1) + ("l" "TFC Lesson" plain + (function chris/org-caputre-denote-file-path) + (file ".templates/lessontemplate.org") + :prepend nil + :jump-to-captured t + :empyt-lines 1) ("P" "TFC Posts" entry (file+headline "nvtfc_social_media.org" "Posts") (file ".templates/posts.org") @@ -842,14 +848,24 @@ much faster. The hope is to also make this a faster version of imenu." ('normal 'org-src-mode-map "q" 'org-edit-src-abort)) -(defun chris/org-roam-capture-lesson-file () +(defun chris/denote-capture-lesson-file () "Function to return the lesson file that is needed for TFC plan capture and move to correct position for plan insertion" (interactive) ;; (unless org-roam-mode (org-roam-mode +1)) - (let ((node (org-roam-node-read))) - (org-roam-node-visit node) + (let* ((files (denote-all-files)) + (lessons (remove nil + (cl-loop for file in files + collect (if (string-match "lessons/" file) file)))) + (lesson (completing-read "Select Lesson: " lessons nil nil '(".*_lesson" . 0)))) + (find-file lesson) (goto-char (point-min)) - (search-forward "PLAN"))) + (search-forward "* PLAN"))) + +(defun chris/org-caputre-denote-file-path () + "Function returning the file placement using denote for capture" + (interactive) + (denote-subdirectory) + (save-buffer)) (defun chris/project-todo () (concat (projectile-project-root) "TODO.org")) @@ -3683,11 +3699,9 @@ interfere with the default `bongo-playlist-buffer'." (defvar bible-books '(genesis exodus leviticus numbers dueteronomy joshua judges ruth 1-samuel 2-samuel 1-kings 2-kings 1-chronicles 2-chronicles ezra nehemiah esther job psalms proverbs ecclesiastes song-of-solomon isaiah jeremiah lamentations ezekiel daniel hosea joel amos obadiah jonah micah nahum habakkuk zephaniah haggai zechariah malachi matthew mark luke john acts romans 1-corinthians 2-corinthians galatians ephesians phillipians colossians 1-thessalonians 2-thessalonians 1-timothy 2-timothy titus philemon hebrews james 1-peter 2-peter 1-john 2-john 3-john jude revelation)) -(org-list-get-subtree *genesis* idk) - (defun chris/find-verse () (interactive) - (find-file "/home/chris/docs/notes/bibles/esv.org") + (find-file "/home/chris/docs/bibles/esv.org") (list (imenu-choose-buffer-index))) ;; Reduce rendering/line scan work for Emacs by not rendering cursors or regions