org denote

This commit is contained in:
Michael Thomson 2025-07-10 17:01:13 -04:00
parent bbb8267e6e
commit 960cef314e
3 changed files with 91 additions and 48 deletions

View File

@ -45,17 +45,13 @@
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [
taskwarrior-tui
hidden-bar hidden-bar
presenterm presenterm
(azure-cli.withExtensions [ (azure-cli.withExtensions [
azure-cli.extensions.containerapp azure-cli.extensions.containerapp
]) ])
azure-functions-core-tools
dotnet-sdk
watchman
typescript-language-server
scrcpy scrcpy
nh
]; ];
programs.home-manager.enable = true; programs.home-manager.enable = true;

View File

@ -16,6 +16,7 @@
cmake cmake
libtool libtool
glibtool glibtool
graphviz
]; ];
programs.emacs = { programs.emacs = {

View File

@ -131,8 +131,7 @@
(org-outline-path-complete-in-steps nil) (org-outline-path-complete-in-steps nil)
:config :config
(setq org-directory "~/org") (setq org-directory "~/org")
;;(setq org-agenda-files (list "everything.org")) (setq org-agenda-files (list "todo.org"))
(add-to-list 'org-tags-exclude-from-inheritance "project")
:hook :hook
(org-mode . org-indent-mode) (org-mode . org-indent-mode)
:init :init
@ -143,51 +142,98 @@
:straight t :straight t
:hook (org-mode . toc-org-mode)) :hook (org-mode . toc-org-mode))
(use-package org-roam ;; (use-package org-roam
;; :ensure t
;; :straight t
;; :custom
;; (org-roam-directory (file-truename "~/org"))
;; (org-roam-capture-templates
;; '(("d" "default" plain "%?"
;; :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
;; "#+title: ${title}\n#+date: %U\n"))
;; ("p" "project" plain "* People\n\n* Tasks\n\n** TODO Add initial tasks\n\n* Dates\n\n"
;; :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+category: ${title}\n#+filetags: project")
;; :unnarrowed t)))
;; (org-roam-dailies-capture-templates
;; '(("d" "default" entry "* %<%I:%M %p>: %?"
;; :if-new (file+head "%<%Y-%m-%d>.org"
;; "#+title: %<%Y-%m-%d>\n")
;; :unnarrowed t)))
;; :bind (("C-c n l" . org-roam-buffer-toggle)
;; ("C-c n f" . org-roam-node-find)
;; ("C-c n g" . org-roam-graph)
;; ("C-c n i" . org-roam-node-insert)
;; ("C-c n c" . org-roam-capture)
;; ("C-c n b" . mthomson/org-roam-capture-inbox)
;; ;; Dailies
;; ("C-c n j" . org-roam-dailies-capture-today))
;; :config
;; ;; If you're using a vertical completion framework, you might want a more informative completion interface
;; (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
;; (org-roam-db-autosync-mode)
;; ;; If using org-roam-protocol
;; (require 'org-roam-protocol)
;; (defun mthomson/org-roam-filter-by-tag (tag-name)
;; (lambda (node)
;; (member tag-name (org-roam-node-tags node))))
;; (defun mthomson/org-roam-list-notes-by-tag (tag-name)
;; (mapcar #'org-roam-node-file
;; (seq-filter
;; (mthomson/org-roam-filter-by-tag tag-name)
;; (org-roam-node-list))))
;; (defun mthomson/org-roam-refresh-agenda-list ()
;; (interactive)
;; (setq org-agenda-files (mthomson/org-roam-list-notes-by-tag "project")))
;; (advice-add 'org-agenda :before #'mthomson/org-roam-refresh-agenda-list)
;; (advice-add 'org-todo-list :before #'mthomson/org-roam-refresh-agenda-list)
;; (advice-add 'org-refile :before #'mthomson/org-roam-refresh-agenda-list)
;; (defun mthomson/org-roam-capture-inbox ()
;; (interactive)
;; (org-roam-capture- :node (org-roam-node-create)
;; :templates '(("i" "inbox" plain "* %?"
;; :if-new (file+head "Inbox.org" "#+title: Inbox\n"))))))
(use-package denote
:ensure t :ensure t
:straight t :straight t
:custom :hook
(org-roam-directory (file-truename "~/org")) ((dired-mode . denote-dired-mode)
(org-roam-capture-templates (text-mode . denote-fontify-links-mode))
'(("d" "default" plain "%?" :bind
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" (("C-c n n" . denote)
"#+title: ${title}\n") ("C-c n r" . denote-rename-file)
:unnarrowed t))) ("C-c n l" . denote-link)
:bind (("C-c n l" . org-roam-buffer-toggle) ("C-c n b" . denote-backlinks)
("C-c n f" . org-roam-node-find) ("C-c n d" . denote-dired))
("C-c n g" . org-roam-graph)
("C-c n i" . org-roam-node-insert)
("C-c n c" . org-roam-capture)
;; Dailies
("C-c n j" . org-roam-dailies-capture-today))
:config :config
;; If you're using a vertical completion framework, you might want a more informative completion interface (setq denote-directory (expand-file-name "~/org/note"))
(setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag))) (denote-rename-buffer-mode 1))
(org-roam-db-autosync-mode)
;; If using org-roam-protocol
(require 'org-roam-protocol)
(defun mthomson/project-files ()
"Return a list of note files containing 'project' tag." ;
(seq-uniq
(seq-map
#'car
(org-roam-db-query
[:select [nodes:file]
:from tags
:left-join nodes
:on (= tags:node-id nodes:id)
:where (like tag (quote "%\"project\"%"))]))))
(defun mthomson/agenda-files-update (&rest _) (use-package consult-denote
"Update the value of `org-agenda-files'." :ensure t
(setq org-agenda-files (mthomson/project-files)) :straight t
(setq org-refile-targets :bind
'((nil :maxlevel . 3) (("C-c n f" . consult-denote-find)
(org-agenda-files :maxlevel . 3)))) ("C-c n g" . consult-denote-grep))
:config
(consult-denote-mode 1))
(advice-add 'org-agenda :before #'mthomson/agenda-files-update) (use-package denote-journal
(advice-add 'org-todo-list :before #'mthomson/agenda-files-update) :ensure t
(advice-add 'org-refile :before #'mthomson/agenda-files-update)) :straight t
:commands ( denote-journal-new-entry
denote-journal-new-or-existing-entry
denote-journal-link-or-create-entry )
:hook (calendar-mode . denote-journal-calendar-mode)
:config
(setq denote-journal-directory
(expand-file-name "journal" denote-directory))
(setq denote-journal-keyword "journal")
(setq denote-journal-title-format 'day-date-month-year))
(use-package org-superstar (use-package org-superstar
:ensure t :ensure t