From 435b1cfb0e440b7807c0a442965a16b551922479 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Thu, 27 Apr 2023 14:59:59 -0400 Subject: [PATCH] Implement a daily note system --- emacs/.emacs.d/config/init-org.el | 115 +++++++++++++++++------------- 1 file changed, 66 insertions(+), 49 deletions(-) diff --git a/emacs/.emacs.d/config/init-org.el b/emacs/.emacs.d/config/init-org.el index 7c04e97..ca9624d 100644 --- a/emacs/.emacs.d/config/init-org.el +++ b/emacs/.emacs.d/config/init-org.el @@ -2,18 +2,29 @@ (use-package org :straight '(org-plus-contrib :type git - :repo "https://git.sr.ht/~bzg/org-contrib") + :repo "https://git.sr.ht/~bzg/org-contrib") :mode (("\\.org\\'" . org-mode)) :init (leader-def-key "o" '(nil :which-key "org")) :config (add-hook 'org-mode-hook #'auto-fill-mode) (add-hook 'org-mode-hook (lambda () (require 'org-attach))) + (defun org-find-daily-note () + (interactive) + (let* ((filename (expand-file-name + (format "~/org/daily/%s.org" + (format-time-string "%Y-%m-%d")))) + (file-exists (file-exists-p filename))) + (find-file filename) + (goto-char (point-min)) + (unless file-exists + (insert (format "* %s daily note" + (format-time-string "%Y-%m-%d"))) + (newline)) + (goto-char (point-max)))) :custom (org-agenda-files `(,(expand-file-name "~/org/todo.org") - ,(expand-file-name "~/org/lola-gcal.org") - ,(expand-file-name "~/org/personal-gcal.org") - ,(expand-file-name "~/org/j-n-gcal.org"))) + ,(expand-file-name "~/org/daily"))) (org-todo-keywords '((sequence "TODO(t)" "IN PROGRESS(i)" @@ -21,7 +32,10 @@ "|" "DONE(d)" "CANCELLED(c)"))) - (org-capture-templates `(("s" "Spotify task" entry + (org-capture-templates `(("d" "Daily note" plain + (function org-find-daily-note) + "* %<%I:%M %p>") + ("s" "Spotify task" entry (file+headline ,(expand-file-name "~/org/todo.org") "Spotify") "* TODO %i%?") ("p" "Personal task" entry @@ -47,6 +61,7 @@ (leader-map "oa" #'org-agenda) (leader-map "oc" #'org-capture) (leader-map "ol" #'org-store-link) + (leader-map "od" #'org-find-daily-note) (normal org-mode-map "" #'org-return) (normal org-mode-map "T" #'org-insert-todo-heading)) @@ -66,57 +81,59 @@ (setq org-super-agenda-header-map (make-sparse-keymap)) :custom (org-super-agenda-groups `((:name "In progress" - :todo "IN PROGRESS") + :todo "IN PROGRESS") + (:name "Daily" + :file-path ,(expand-file-name "~/org/daily")) (:name "Spotify" - :tag "@spotify") + :tag "@spotify") (:name "Lola" - :tag "@lola") + :tag "@lola") (:name "unifyDB" - :tag "@unifydb") + :tag "@unifydb") (:name "Personal" - :tag "@personal") + :tag "@personal") (:name "Jira" :file-path ,(expand-file-name "~/org/jira"))))) -(use-package org-gcal - :commands (org-gcal-sync - org-gcal-fetch - org-gcal-post-at-point - org-gcal-delete-at-point - org-gcal-request-token) - :after (org evil-org) - :init - (defun org-agenda-redo-and-fetch-gcal (&optional all) - (interactive "P") - (let ((cb (if all #'org-agenda-redo-all #'org-agenda-redo))) - (deferred:nextc (org-gcal-fetch) cb))) - (advice-add 'evil-org-agenda-set-keys :after - (lambda () - (general-def 'motion org-agenda-mode-map - "gR" #'org-agenda-redo-and-fetch-gcal))) - :config - (setq org-gcal-client-id (password-store-get "lola-org-gcal-client-id") - org-gcal-client-secret (password-store-get "lola-org-gcal-client-secret") - org-gcal-fetch-file-alist `(("jeremydormitzer@lola.com" . - ,(expand-file-name "~/org/lola-gcal.org")) - ("jeremy.dormitzer@gmail.com" . - ,(expand-file-name "~/org/personal-gcal.org")) - ("lut2o2moohg6qkdsto1qfq7th4@group.calendar.google.com" . - ,(expand-file-name "~/org/j-n-gcal.org"))) - org-gcal-notify-p nil)) +;; (use-package org-gcal +;; :commands (org-gcal-sync +;; org-gcal-fetch +;; org-gcal-post-at-point +;; org-gcal-delete-at-point +;; org-gcal-request-token) +;; :after (org evil-org) +;; :init +;; (defun org-agenda-redo-and-fetch-gcal (&optional all) +;; (interactive "P") +;; (let ((cb (if all #'org-agenda-redo-all #'org-agenda-redo))) +;; (deferred:nextc (org-gcal-fetch) cb))) +;; (advice-add 'evil-org-agenda-set-keys :after +;; (lambda () +;; (general-def 'motion org-agenda-mode-map +;; "gR" #'org-agenda-redo-and-fetch-gcal))) +;; :config +;; (setq org-gcal-client-id (password-store-get "lola-org-gcal-client-id") +;; org-gcal-client-secret (password-store-get "lola-org-gcal-client-secret") +;; org-gcal-fetch-file-alist `(("jeremydormitzer@lola.com" . +;; ,(expand-file-name "~/org/lola-gcal.org")) +;; ("jeremy.dormitzer@gmail.com" . +;; ,(expand-file-name "~/org/personal-gcal.org")) +;; ("lut2o2moohg6qkdsto1qfq7th4@group.calendar.google.com" . +;; ,(expand-file-name "~/org/j-n-gcal.org"))) +;; org-gcal-notify-p nil)) -(use-package org-jira - :after (org) - :init - (setq jiralib-url "https://lola.atlassian.net" - org-jira-working-dir (expand-file-name "~/org/jira") - org-jira-jira-status-to-org-keyword-alist '(("To Do" . "TODO") - ("Blocked" . "BLOCKED") - ("In Progress" . "IN PROGRESS") - ("Code Review" . "IN PROGRESS") - ("Awaiting Release" . "IN PROGRESS") - ("Done" . "DONE") - ("Won't Fix" . "CANCELLED"))) - (add-to-list 'org-agenda-files org-jira-working-dir)) +;; (use-package org-jira +;; :after (org) +;; :init +;; (setq jiralib-url "https://lola.atlassian.net" +;; org-jira-working-dir (expand-file-name "~/org/jira") +;; org-jira-jira-status-to-org-keyword-alist '(("To Do" . "TODO") +;; ("Blocked" . "BLOCKED") +;; ("In Progress" . "IN PROGRESS") +;; ("Code Review" . "IN PROGRESS") +;; ("Awaiting Release" . "IN PROGRESS") +;; ("Done" . "DONE") +;; ("Won't Fix" . "CANCELLED"))) +;; (add-to-list 'org-agenda-files org-jira-working-dir)) ;; org-roam provides backlinks between org documents (use-package org-roam