From bd060d090d171823f2de9fd66a3baa977b32bc16 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Wed, 28 Feb 2024 14:11:41 +0100 Subject: Overhaul org config. Better agenda, lazy loading, etc. --- init.org | 153 +++++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 115 insertions(+), 38 deletions(-) diff --git a/init.org b/init.org index dfe71a7..4aa881b 100644 --- a/init.org +++ b/init.org @@ -446,38 +446,117 @@ When working on Guix it helps to reduce boilerplate with snippets. I like to ha This is my org mode configuration. Much of it is in one big blob and I haven’t yet taken the time to document it. #+BEGIN_SRC elisp -(setq org-ellipsis "⤵") -(setq org-src-fontify-natively t) - -(global-set-key (kbd "C-c o l") 'org-store-link) -(global-set-key (kbd "C-c o a") 'org-agenda) - -;; TODO: make these available in org-mode only -(global-set-key (kbd "C-c o s") 'org-schedule) - -(setq org-log-done t) -(setq org-return-follows-link t) - -(setq org-directory "~/Documents/org") -(setq org-agenda-files (mapcar (lambda (x) (concat org-directory x)) - (list "/master.org" - "/email.org" - "/todo.org" - "/inbox.org" - "/birthdays.org"))) -(setq org-default-notes-file (concat org-directory "/notes.org")) - -(setq org-agenda-custom-commands - '(("w" todo "WAITING" nil) - ("n" todo "NEXT" nil) - ("d" "Agenda + Next Actions" ((agenda) (todo "NEXT"))))) - -(setq org-fontify-done-headline t) - +(use-package org + :config + (setq org-ellipsis "⤵") + (setq org-src-fontify-natively t) + + (global-set-key (kbd "C-c o l") 'org-store-link) + (global-set-key (kbd "C-c o a") 'org-agenda) + + (setq org-log-done t) + (setq org-return-follows-link t) + (setq org-tag-alist '(("project" . ?p) + ("fun" . ?f) + ("kita" . ?k) + ("work" . ?w))) + + (setq org-directory "~/Documents/org") + (setq org-agenda-files (mapcar (lambda (x) (concat org-directory x)) + (list "/master.org" + "/todo.org" + "/inbox.org" + "/birthdays.org"))) + (setq org-default-notes-file (concat org-directory "/notes.org")) + (setq org-agenda-breadcrumbs-separator " ❱ ") + (setq org-agenda-format-date 'my-org-agenda-format-date-aligned) + + (defun my-org-agenda-format-date-aligned (date) + "Format a DATE string for display in the daily/weekly agenda, or timeline. +This function makes sure that dates are aligned for easy reading." + (let* ((dayname + (let ((calendar-day-name-array (vector "天" "一" "二" "三" "四" "五" "六"))) + (calendar-day-name date))) + (day (cadr date)) + (day-of-week (calendar-day-of-week date)) + (month (car date)) + (monthname (calendar-month-name month))) + (format " %-2s %2d %s" + dayname day monthname))) + + (setq org-agenda-custom-commands + '(("a" "My Agenda" + ((agenda "" ((org-agenda-skip-scheduled-if-done nil) + (org-agenda-time-leading-zero t) + (org-agenda-timegrid-use-ampm nil) + (org-agenda-skip-timestamp-if-done nil) + (org-agenda-skip-deadline-if-done t) + (org-agenda-start-day "+0d") + (org-agenda-span 7) + (org-agenda-overriding-header "⚡ Calendar") + (org-agenda-repeating-timestamp-show-all nil) + (org-agenda-remove-tags t) + (org-agenda-prefix-format " %-3i %-15b%t %s") + (org-agenda-time) + (org-agenda-current-time-string "ᐊ┈┈┈┈┈┈┈ Now") + (org-agenda-scheduled-leaders '("" "")) + (org-agenda-deadline-leaders '("Deadline: " "In %3d d.: " "%2d d. ago: ")) + (org-agenda-time-grid (quote ((today require-timed remove-match) () " " "┈┈┈┈┈┈┈┈┈┈┈┈┈"))))) + (tags "-CATEGORY=\"work\"+TODO=\"TODO\"" + ((org-agenda-overriding-header "\n⚡ Next") + (org-agenda-sorting-strategy '(priority-down)) + (org-agenda-remove-tags t) + (org-agenda-skip-function '(org-agenda-skip-entry-if 'timestamp 'scheduled)) + (org-agenda-todo-ignore-scheduled 'all) + (org-agenda-prefix-format "%-2i %?b") + (org-agenda-todo-keyword-format ""))) + (tags "+project-CATEGORY=\"work\"" + ((org-agenda-overriding-header "\n⚡ Projects") + (org-agenda-sorting-strategy '(alpha-up)) + (org-agenda-remove-tags t) + (org-tags-match-list-sublevels nil) + (org-agenda-show-inherited-tags nil) + (org-agenda-prefix-format "%-2i %?b") + (org-agenda-todo-keyword-format ""))))) + ("w" "Work Agenda" + ((agenda "" ((org-agenda-skip-scheduled-if-done nil) + (org-agenda-time-leading-zero t) + (org-agenda-timegrid-use-ampm nil) + (org-agenda-skip-timestamp-if-done nil) + (org-agenda-skip-deadline-if-done t) + (org-agenda-start-day "+0d") + (org-agenda-span 7) + (org-agenda-overriding-header "⚡ Calendar") + (org-agenda-repeating-timestamp-show-all nil) + (org-agenda-remove-tags t) + (org-agenda-prefix-format " %-3i %-15b%t %s") + (org-agenda-todo-keyword-format "") + (org-agenda-time) + (org-agenda-current-time-string "ᐊ┈┈┈┈┈┈┈ Now") + (org-agenda-scheduled-leaders '("" "")) + (org-agenda-deadline-leaders '("Deadline: " "In %3d d.: " "%2d d. ago: ")) + (org-agenda-time-grid (quote ((today require-timed remove-match) () " " "┈┈┈┈┈┈┈┈┈┈┈┈┈"))))) + (tags "+CATEGORY=\"work\"+TODO=\"TODO\"" + ((org-agenda-overriding-header "\n⚡ Next") + (org-agenda-sorting-strategy '(priority-down)) + (org-agenda-remove-tags t) + (org-agenda-todo-ignore-scheduled 'all) + (org-agenda-prefix-format "%-2i %?b") + (org-agenda-todo-keyword-format ""))) + (tags "+project+CATEGORY=\"work\"" + ((org-agenda-overriding-header "\n⚡ Projects") + (org-agenda-sorting-strategy '(alpha-up)) + (org-agenda-remove-tags t) + (org-tags-match-list-sublevels nil) + (org-agenda-show-inherited-tags nil) + (org-agenda-prefix-format "%-2i %?b") + (org-agenda-todo-keyword-format ""))))))) + + (setq org-fontify-done-headline t) + (defun gtd () + (interactive) + (find-file (concat org-directory "/master.org")))) -(defun gtd () - (interactive) - (find-file (concat org-directory "/master.org"))) (use-package org-modern :after org :init @@ -494,6 +573,7 @@ This is my org mode configuration. Much of it is in one big blob and I haven’ org-hide-emphasis-markers t org-pretty-entities t org-ellipsis "…" + org-modern-block-fringe 1 ;; Agenda styling org-agenda-tags-column 0 @@ -503,7 +583,7 @@ This is my org mode configuration. Much of it is in one big blob and I haven’ (800 1000 1200 1400 1600 1800 2000) " ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄") org-agenda-current-time-string - "⭠ now ─────────────────────────────────────────────────") + "ᐊ┈┈┈┈┈┈┈ Now") (global-org-modern-mode)) #+END_SRC @@ -605,12 +685,9 @@ I use the capture feature to quickly record ideas and tasks, and to create links `(("i" "Inbox" entry (file ,(concat org-directory "/inbox.org")) ,(concat "* TODO %?\n" "/Entered on/ %U")) - ("t" "Task" entry - (file+headline (concat org-directory "/inbox.org") "Tasks") - "* %?\n %i\n %a") - ("m" "Email" entry - (file+headline (concat org-directory "/email.org") "Email") - "* Reply to %:fromname%? :email:\n [%:date]\n To: %:to\n %a"))) + ("a" "Appointment" entry + (file+headline ,(concat org-directory "/todo.org") "Appointments") + "* %?\n/Entered on/ %U"))) (defun org-capture-inbox () (interactive) -- cgit v1.2.3