From 48e1c41198179bb1860ff585d4a402ecd5070702 Mon Sep 17 00:00:00 2001 From: Ray Andrew Date: Fri, 26 Dec 2025 03:08:22 -0600 Subject: [PATCH] feat(org): fix agenda workflow --- config/emacs/post-init.el | 129 ++++++++++++++++++++++----- docs/emacs.md | 177 ++++++++++++++++++++++++++++++++++++++ docs/mu4e.md | 97 --------------------- 3 files changed, 284 insertions(+), 119 deletions(-) create mode 100644 docs/emacs.md delete mode 100644 docs/mu4e.md diff --git a/config/emacs/post-init.el b/config/emacs/post-init.el index 3689bcd..e99e12d 100644 --- a/config/emacs/post-init.el +++ b/config/emacs/post-init.el @@ -586,7 +586,7 @@ frame if FRAME is nil, and to 1 if AMT is nil." (setq org-directory "~/NPersonal/") ; Non-absolute paths for agenda and ; capture templates will look here. -(setq org-agenda-files '("inbox.org" "work.org")) +(setq org-agenda-files '("agenda.org")) ;; Default tags (setq org-tag-alist '( @@ -609,13 +609,44 @@ frame if FRAME is nil, and to 1 if AMT is nil." ("reading"))) ;; Org-refile: where should org-refile look? -(setq org-refile-targets 'FIXME) +(setq org-refile-targets '(("agenda.org" :maxlevel . 2) + ("archive.org" :level . 1))) + +;; Archive location +(setq org-archive-location "archive.org::* Archived") ;;; Phase 3 variables -;; Org-roam variables -(setq org-roam-directory "~/NPersonal/roam/") -(setq org-roam-index-file "~/NPersonal/roam/index.org") +;; Denote (zettelkasten with markdown) +(use-package denote + :ensure t + :custom + (denote-directory "~/NPersonal/") + (denote-file-type 'markdown-yaml) ;; Use markdown with YAML front matter + (denote-known-keywords '("project" "idea" "ref" "meeting" "paper")) + (denote-prompts '(title keywords)) + :bind + (("C-c n n" . denote) ;; Create new note + ("C-c n f" . denote-open-or-create) + ("C-c n i" . denote-link) ;; Insert link to note + ("C-c n l" . denote-backlinks) ;; Show backlinks + ("C-c n r" . denote-rename-file) + ("C-c n k" . denote-keywords-add) + ("C-c n K" . denote-keywords-remove)) + :config + ;; Enable denote links in org + (denote-rename-buffer-mode 1)) + +;; Denote org extras (better org integration) +(use-package denote-org-extras + :ensure nil + :after denote + :config + ;; Create org links to denote files + (denote-org-extras-dblock-backlinks-mode 1) + :bind + (("C-c n b" . denote-org-extras-backlinks-for-heading) + ("C-c n h" . denote-org-extras-link-to-heading))) ;;; Optional variables @@ -629,12 +660,38 @@ frame if FRAME is nil, and to 1 if AMT is nil." :elpaca nil :hook ((org-mode . visual-line-mode) ; wrap lines at word breaks (org-mode . flyspell-mode)) ; spell checking! + :init + ;; Load mu4e-org for email links (before org loads) + (with-eval-after-load 'org + (require 'mu4e-org nil t)) + + ;; Open agenda on startup (deferred) + (add-hook 'elpaca-after-init-hook + (lambda () + (run-with-idle-timer 1 nil #'org-agenda nil "n"))) :bind (:map global-map + ("C-c a" . org-agenda) ; Agenda + ("C-c c" . org-capture) ; Capture ("C-c l s" . org-store-link) ; Mnemonic: link → store ("C-c l i" . org-insert-link-global)) ; Mnemonic: link → insert + :custom + (org-time-stamp-rounding-minutes '(0 5)) ;; Round to 5 min + (org-read-date-prefer-future t) + (org-return-follows-link t) ;; RET follows links + ;; Agenda settings + (org-agenda-window-setup 'current-window) + (org-agenda-start-with-log-mode t) + (org-agenda-include-diary nil) + (org-agenda-tags-column -80) + (org-agenda-block-separator ?─) + (org-agenda-time-grid '((daily today require-timed) + (800 1000 1200 1400 1600 1800 2000) + " ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄")) + (org-agenda-current-time-string "◀── now ──────────────────────────────────────") :config (require 'oc-csl) ; citation support + (add-to-list 'org-export-backends 'md) (setf (cdr (assoc 'file org-link-frame-setup)) 'find-file) (setq org-export-with-smart-quotes t) @@ -643,29 +700,54 @@ frame if FRAME is nil, and to 1 if AMT is nil." (setq org-outline-path-complete-in-steps nil) (setq org-refile-use-outline-path 'file) (setq org-capture-templates - '(("c" "Default Capture" entry (file "inbox.org") - "* TODO %?\n%U\n%i") + '(("c" "Quick Capture" entry (file+headline "agenda.org" "Inbox") + "** TODO %?\n%U\n%i") ;; Capture and keep an org-link to the thing we're currently working with - ("r" "Capture with Reference" entry (file "inbox.org") - "* TODO %?\n%U\n%i\n%a") - ;; Define a section - ("w" "Work") - ("wm" "Work meeting" entry (file+headline "work.org" "Meetings") + ("r" "Capture with Reference" entry (file+headline "agenda.org" "Inbox") "** TODO %?\n%U\n%i\n%a") - ("wr" "Work report" entry (file+headline "work.org" "Reports") + ("t" "Task" entry (file+headline "agenda.org" "Tasks") + "** TODO %?\n%U\n%i") + ("m" "Meeting" entry (file+headline "agenda.org" "Meetings") "** TODO %?\n%U\n%i\n%a") ;; Email capture ("e" "Email") - ("et" "Email TODO" entry (file "inbox.org") - "* TODO %:fromname: %:subject\n%U\n%a\n\n%?") - ("ef" "Email Follow-up" entry (file "inbox.org") - "* TODO Follow up: %:subject\nDEADLINE: %(org-insert-time-stamp (org-read-date nil t \"+2d\"))\n%U\n%a\n\n%?"))) + ("ei" "Email to Inbox" entry (file+headline "agenda.org" "Inbox") + "** TODO %:subject\nFrom: %:fromname <%:fromaddress>\nEmail: %a\n%?") + ("et" "Email to Tasks" entry (file+headline "agenda.org" "Tasks") + "** TODO %:subject\nFrom: %:fromname <%:fromaddress>\nEmail: %a\n%?") + ("ef" "Email Follow-up" entry (file+headline "agenda.org" "Tasks") + "** TODO Follow up: %:subject\nDEADLINE: %(org-insert-time-stamp (org-read-date nil t \"+2d\"))\nFrom: %:fromname\nEmail: %a\n%?"))) (setq org-agenda-custom-commands - '(("n" "Agenda and All Todos" - ((agenda) - (todo))) - ("w" "Work" agenda "" - ((org-agenda-files '("work.org"))))))) + '(("n" "Dashboard" + ((tags-todo "+DEADLINE<\"\"" + ((org-agenda-overriding-header "Overdue!"))) + (agenda "" ((org-agenda-span 'day) + (org-deadline-warning-days 7) + (org-agenda-time-grid nil) + (org-agenda-overriding-header "Today"))) + (todo "STARTED" + ((org-agenda-overriding-header "In Progress"))) + (todo "WAITING" + ((org-agenda-overriding-header "Waiting"))) + (tags-todo "+DEADLINE>=\"\"+DEADLINE<=\"<+7d>\"" + ((org-agenda-overriding-header "Due This Week"))) + (tags-todo "inbox" + ((org-agenda-overriding-header "Inbox"))) + (agenda "" ((org-agenda-span 7) + (org-agenda-start-day "+1d") + (org-agenda-start-on-weekday nil) + (org-agenda-show-all-dates t) + (org-agenda-time-grid nil) + (org-agenda-overriding-header "Next 7 Days"))) + (alltodo "" + ((org-agenda-skip-function + '(org-agenda-skip-entry-if 'scheduled 'deadline 'todo '("STARTED" "WAITING"))) + (org-agenda-overriding-header "Backlog"))))) + ("w" "Week View" + ((agenda "" ((org-agenda-span 'week) + (org-deadline-warning-days 14))))) + ("i" "Inbox" tags-todo "inbox") + ("p" "Projects" tags-todo "project")))) ;; ========================= ;; Email (mu4e) @@ -686,6 +768,9 @@ frame if FRAME is nil, and to 1 if AMT is nil." (setq mu4e-mu-binary (or (executable-find "mu") "/etc/profiles/per-user/rayandrew/bin/mu")) + ;; Enable org-mode link support + (require 'mu4e-org) + ;; General settings (setq mu4e-maildir "~/mail") (setq mu4e-get-mail-command "~/dotfiles/bin/path-shim mbsync -a") diff --git a/docs/emacs.md b/docs/emacs.md new file mode 100644 index 0000000..12e1bcc --- /dev/null +++ b/docs/emacs.md @@ -0,0 +1,177 @@ +# Emacs Configuration + +## Notes & Org + +### Directory Structure + +- `~/NPersonal/agenda.org` - All tasks (Inbox, Tasks, Meetings) +- `~/NPersonal/archive.org` - Completed/archived items +- `~/NPersonal/*.md` - Denote markdown notes + +### agenda.org Structure + +```org +* Inbox <- quick captures +* Tasks <- organized tasks +* Meetings <- meetings +``` + +### Org Agenda + +| Key | Action | +|-----|--------| +| `C-c a` | Open agenda dispatcher | +| `C-c c` | Capture (quick note/todo) | + +#### In Agenda View + +| Key | Action | +|-----|--------| +| `n` / `p` | Next / previous item | +| `t` | Cycle TODO state | +| `RET` | Go to item | +| `q` | Quit agenda | + +### Org Mode + +| Key | Action | +|-----|--------| +| `C-c C-t` | Cycle TODO state | +| `C-c C-s` | Schedule | +| `C-c C-d` | Set deadline | +| `C-c C-w` | Refile to another file/heading | +| `C-c C-x C-a` | Archive subtree | +| `C-c l s` | Store link | +| `C-c l i` | Insert link | + +### Capture Templates (`C-c c`) + +| Key | Action | +|-----|--------| +| `c` | Quick capture to Inbox | +| `r` | Capture with reference | +| `t` | Task | +| `m` | Meeting | +| `e i` | Email to Inbox | +| `e t` | Email to Tasks | +| `e f` | Email follow-up with deadline | + +### Denote (Markdown Notes) + +Notes are saved as: `20241226T123456--title__keyword1_keyword2.md` + +| Key | Action | +|-----|--------| +| `C-c n n` | Create new note | +| `C-c n f` | Find or create note | +| `C-c n i` | Insert link to note | +| `C-c n l` | Show backlinks | +| `C-c n r` | Rename file | +| `C-c n k` | Add keyword | +| `C-c n K` | Remove keyword | +| `C-c n b` | Backlinks for org heading | +| `C-c n h` | Link to org heading | + +### Archive + +Completed tasks go to `archive.org` under `* Archived` heading. + +- `C-c C-x C-a` - Archive current subtree +- `C-c C-w` then select `archive.org` - Refile to archive + +--- + +## Email (mu4e) + +### Launch + +| Key | Action | +|-----|--------| +| `C-c e` | Open mu4e | + +### Main View + +| Key | Action | +|-----|--------| +| `U` | Update mail (run mbsync) | +| `j` | Jump to maildir | +| `s` | Search | +| `b` | Bookmarks | +| `C` | Compose new message | +| `;` | Switch context (account) | +| `q` | Quit mu4e | + +### Headers View (Message List) + +| Key | Action | +|-----|--------| +| `n` / `p` | Next / previous message | +| `RET` | View message | +| `d` | Mark for trash | +| `D` | Mark for delete | +| `t` | Mark for action (prompts) | +| `u` | Unmark | +| `m` | Move to folder | +| `e` | Refile (archive) | +| `+` / `-` | Mark / unmark flag | +| `!` | Mark as read | +| `?` | Mark as unread | +| `r` | Reply | +| `R` | Reply all | +| `F` | Forward | +| `x` | Execute marked actions | +| `U` | Unmark all | +| `%` | Mark by pattern | +| `T` | Mark thread | +| `g` | Rerun search | +| `q` | Quit to main view | + +### Message View + +| Key | Action | +|-----|--------| +| `n` / `p` | Next / previous message | +| `SPC` / `DEL` | Scroll down / up | +| `r` | Reply | +| `R` | Reply all | +| `F` | Forward | +| `o` | Open attachment | +| `e` | Save attachment | +| `a` | View action (open in browser, etc.) | +| `#` | Toggle citation folding | +| `.` | Raw view | +| `h` | Toggle headers | +| `q` | Return to headers | + +### Compose + +| Key | Action | +|-----|--------| +| `C-c C-c` | Send message | +| `C-c C-k` | Kill (discard) message | +| `C-c C-d` | Save as draft | +| `C-c C-a` | Attach file | +| `C-c C-s` | GPG sign message | +| `C-c C-e` | GPG encrypt message | + +### Bookmarks (from main view, press `b`) + +| Key | Action | +|-----|--------| +| `u` | Unread messages | +| `t` | Today's messages | +| `w` | Last 7 days | +| `i` | UChicago Inbox | +| `p` | Personal Inbox | + +### Search Tips + +- `from:john` - messages from john +- `to:jane` - messages to jane +- `subject:meeting` - subject contains meeting +- `flag:unread` - unread messages +- `flag:attach` - messages with attachments +- `date:today..now` - today's messages +- `date:7d..now` - last 7 days +- `maildir:/uchicago/Inbox` - specific maildir +- `AND`, `OR`, `NOT` - boolean operators diff --git a/docs/mu4e.md b/docs/mu4e.md deleted file mode 100644 index 31cb138..0000000 --- a/docs/mu4e.md +++ /dev/null @@ -1,97 +0,0 @@ -# mu4e Configuration - -## Launch - -| Key | Action | -|-----|--------| -| `C-c e` | Open mu4e | - -## Main View - -| Key | Action | -|-----|--------| -| `U` | Update mail (run mbsync) | -| `j` | Jump to maildir | -| `s` | Search | -| `b` | Bookmarks | -| `C` | Compose new message | -| `;` | Switch context (account) | -| `q` | Quit mu4e | - -## Headers View (Message List) - -| Key | Action | -|-----|--------| -| `n` / `p` | Next / previous message | -| `RET` | View message | -| `d` | Mark for trash | -| `D` | Mark for delete | -| `t` | Mark for action (prompts) | -| `u` | Unmark | -| `m` | Move to folder | -| `e` | Refile (archive) | -| `+` / `-` | Mark / unmark flag | -| `!` | Mark as read | -| `?` | Mark as unread | -| `r` | Reply | -| `R` | Reply all | -| `F` | Forward | -| `x` | Execute marked actions | -| `u` | Unmark | -| `U` | Unmark all | -| `*` | Mark for something | -| `#` | Mark for deferred trash | -| `%` | Mark by pattern | -| `T` | Mark thread | -| `g` | Rerun search | -| `q` | Quit to main view | - -## Message View - -| Key | Action | -|-----|--------| -| `n` / `p` | Next / previous message | -| `SPC` / `DEL` | Scroll down / up | -| `r` | Reply | -| `R` | Reply all | -| `F` | Forward | -| `o` | Open attachment | -| `e` | Save attachment | -| `a` | View action (open in browser, etc.) | -| `#` | Toggle citation folding | -| `.` | Raw view | -| `h` | Toggle headers | -| `q` | Return to headers | - -## Compose - -| Key | Action | -|-----|--------| -| `C-c C-c` | Send message | -| `C-c C-k` | Kill (discard) message | -| `C-c C-d` | Save as draft | -| `C-c C-a` | Attach file | -| `C-c C-s` | GPG sign message (custom) | -| `C-c C-e` | GPG encrypt message | - -## Bookmarks (from main view, press `b`) - -| Key | Action | -|-----|--------| -| `u` | Unread messages | -| `t` | Today's messages | -| `w` | Last 7 days | -| `i` | UChicago Inbox | -| `p` | Personal Inbox | - -## Search Tips - -- `from:john` - messages from john -- `to:jane` - messages to jane -- `subject:meeting` - subject contains meeting -- `flag:unread` - unread messages -- `flag:attach` - messages with attachments -- `date:today..now` - today's messages -- `date:7d..now` - last 7 days -- `maildir:/uchicago/Inbox` - specific maildir -- `AND`, `OR`, `NOT` - boolean operators