diff options
author | Raul Benencia <id@rbenencia.name> | 2023-02-21 19:44:16 -0800 |
---|---|---|
committer | Raul Benencia <id@rbenencia.name> | 2023-02-21 19:44:16 -0800 |
commit | 492049470fa3d486d909f50ddca59b335c8a44bb (patch) | |
tree | 2a11a54593dc6f63c9985bb02b5d28ae2db2e3ba | |
parent | 4cd3b3371dcf77171b98dc12f48da248b2f703b2 (diff) |
emacs: reorganize org files
-rw-r--r-- | .emacs | 3 | ||||
-rw-r--r-- | .emacs.local.d/lisp/packages/rul-org-agenda.el | 40 | ||||
-rw-r--r-- | .emacs.local.d/lisp/packages/rul-org-journal.el (renamed from .emacs.local.d/modes/org-journal.el) | 2 | ||||
-rw-r--r-- | .emacs.local.d/lisp/packages/rul-org-roam.el (renamed from .emacs.local.d/modes/org-roam.el) | 3 | ||||
-rw-r--r-- | .emacs.local.d/lisp/packages/rul-org.el (renamed from .emacs.local.d/modes/org.el) | 193 |
5 files changed, 48 insertions, 193 deletions
@@ -23,9 +23,6 @@ (load-file "~/.emacs.local.d/modes/markdown.el") (load-file "~/.emacs.local.d/modes/magit.el") (load-file "~/.emacs.local.d/modes/notmuch.el") -(load-file "~/.emacs.local.d/modes/org.el") -(load-file "~/.emacs.local.d/modes/org-journal.el") -(load-file "~/.emacs.local.d/modes/org-roam.el") (load-file "~/.emacs.local.d/modes/projectile.el") (load-file "~/.emacs.local.d/modes/tabbar.el") (load-file "~/.emacs.local.d/modes/which-key.el") diff --git a/.emacs.local.d/lisp/packages/rul-org-agenda.el b/.emacs.local.d/lisp/packages/rul-org-agenda.el new file mode 100644 index 0000000..f978ea7 --- /dev/null +++ b/.emacs.local.d/lisp/packages/rul-org-agenda.el @@ -0,0 +1,40 @@ +(require 'org) + +(global-set-key (kbd "<f12>") #'org-agenda) +(global-set-key (kbd "C-c a") #'org-agenda) + +;; AGENDA VIEW ;; + +(setq org-agenda-files my-org-agenda-files) +(setq org-agenda-custom-commands my-org-agenda-custom-commands) + +;; Do not dim blocked tasks +(setq org-agenda-compact-blocks nil) +(setq org-agenda-dim-blocked-tasks nil) +(setq org-agenda-block-separator 61) + +;; Agenda log mode items to display (closed and state changes by default) +(setq org-agenda-log-mode-items (quote (closed state))) + +; For tag searches ignore tasks with scheduled and deadline dates +(setq org-agenda-tags-todo-honor-ignore-options t) + +;; Credits: https://200ok.ch/posts/2022-02-13_integrating_org_mode_agenda_into_other_calendar_apps.html +(defun org-agenda-export-to-ics () + ;; Run all custom agenda commands that have a file argument. + (org-batch-store-agenda-views) + + ;; Org mode correctly exports TODO keywords as VTODO events in ICS. + ;; However, some proprietary calendars do not really work with + ;; standards (looking at you Google), so VTODO is ignored and only + ;; VEVENT is read. + (with-current-buffer (find-file-noselect my-org-agenda-private-local-path) + (goto-char (point-min)) + (while (re-search-forward "VTODO" nil t) + (replace-match "VEVENT")) + (save-buffer)) + + ;; Copy the ICS file to a remote server (Tramp paths work). + (copy-file my-org-agenda-private-local-path my-org-agenda-private-remote-path t)) + +(provide 'rul-org-agenda) diff --git a/.emacs.local.d/modes/org-journal.el b/.emacs.local.d/lisp/packages/rul-org-journal.el index 7bf217d..ab07a19 100644 --- a/.emacs.local.d/modes/org-journal.el +++ b/.emacs.local.d/lisp/packages/rul-org-journal.el @@ -12,3 +12,5 @@ org-journal-time-prefix my-org-journal-time-prefix org-journal-time-format my-org-journal-time-format org-journal-date-format "%A, %d %B %Y")) + +(provide 'rul-org-journal) diff --git a/.emacs.local.d/modes/org-roam.el b/.emacs.local.d/lisp/packages/rul-org-roam.el index 422eb93..0184459 100644 --- a/.emacs.local.d/modes/org-roam.el +++ b/.emacs.local.d/lisp/packages/rul-org-roam.el @@ -1,5 +1,6 @@ (use-package org-roam :ensure t + :after rul-org :custom (org-roam-directory my-org-roam-directory) :init @@ -21,3 +22,5 @@ #'org-roam-reflinks-section #'org-roam-unlinked-references-section)) ) + +(provide 'rul-org-roam) diff --git a/.emacs.local.d/modes/org.el b/.emacs.local.d/lisp/packages/rul-org.el index c22047e..5c96906 100644 --- a/.emacs.local.d/modes/org.el +++ b/.emacs.local.d/lisp/packages/rul-org.el @@ -1,5 +1,6 @@ ;; Debian packages: elpa-org elpa-org-bullets ;; Elpa packages: org-modern +(require 'org) (require 'org-capture) (require 'org-protocol) (require 'org-habit) @@ -8,12 +9,7 @@ (require 'org-modern) (require 'rul-config-org) - -;; -------- -;; Org mode -;; -------- - -(require 'org) +(require 'rul-org-agenda) (setq org-cycle-separator-lines 0) (setq org-startup-indented t) @@ -32,8 +28,6 @@ org-fontify-quote-and-verse-blocks t) ;; ORG BINDINGS ;; -(global-set-key (kbd "<f12>") #'org-agenda) -(global-set-key (kbd "C-c a") #'org-agenda) (global-set-key (kbd "C-c l") #'org-store-link) (global-set-key (kbd "C-c c") #'org-capture) (global-set-key (kbd "C-c s") #'org-schedule) @@ -105,164 +99,6 @@ ; Allow refile to create parent tasks with confirmation (setq org-refile-allow-creating-parent-nodes (quote confirm)) -;; AGENDA VIEW ;; - -;; Based on Prot's config: -;; https://protesilaos.com/codelog/2021-12-09-emacs-org-block-agenda/ -(setq my-org-agenda-custom-commands - `( - ("X" "Export files" agenda "-CANCELLED" - ((org-agenda-with-colors nil) - (org-agenda-prefix-format "%t %s") - (org-agenda-current-time-string ,(car (last org-agenda-time-grid))) - (org-agenda-fontify-priorities nil) - (org-agenda-remove-tags t)) - ,(list my-org-agenda-private-local-path)) - ("P" "Projects and tasks" - ( - (agenda "" ( - (org-agenda-overriding-header "š Today's agenda\n") - (org-agenda-span 1) - (org-deadline-warning-days 0) - (org-agenda-block-separator nil) - (org-scheduled-past-days 0) - (org-agenda-skip-function '(org-agenda-skip-subtree-if - 'regexp "EVENT")) - ;; We don't need the `org-agenda-date-today' - ;; highlight because that only has a practical - ;; utility in multi-day views. - (org-agenda-day-face-function (lambda (date) 'org-agenda-date)) - (org-agenda-format-date "%A %-e %B %Y") - )) - (tags-todo "-HOLD-CANCELLED/!" - ((org-agenda-overriding-header "\nš¢ Projects") - (org-agenda-skip-function 'bh/skip-non-projects) - (org-agenda-block-separator nil) - (org-tags-match-list-sublevels 'indented) - (org-agenda-sorting-strategy - '(category-keep)))) - - (tags-todo "-CANCELLED/!NEXT" - ((org-agenda-overriding-header (concat "\nā”Project Next Tasks\n" - (if bh/hide-scheduled-and-waiting-next-tasks - "" - " (including WAITING and SCHEDULED tasks)"))) - (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks) - (org-tags-match-list-sublevels t) - (org-agenda-todo-ignore-scheduled bh/hide-scheduled-and-waiting-next-tasks) - (org-agenda-todo-ignore-deadlines bh/hide-scheduled-and-waiting-next-tasks) - (org-agenda-todo-ignore-with-date bh/hide-scheduled-and-waiting-next-tasks) - (org-agenda-block-separator nil) - (org-agenda-sorting-strategy - '(todo-state-down effort-up category-keep)))) - - (tags-todo "-HOLD-CANCELLED/!" - ((org-agenda-overriding-header "\nš« Stuck Projects\n") - (org-agenda-skip-function 'bh/skip-non-stuck-projects) - (org-agenda-block-separator nil) - (org-agenda-sorting-strategy - '(category-keep)))) - (tags-todo "-REFILE-CANCELLED-WAITING-HOLD/!" - ((org-agenda-overriding-header (concat "\nā”Standalone Tasks\n" - (if bh/hide-scheduled-and-waiting-next-tasks - "" - " (including WAITING and SCHEDULED tasks)"))) - (org-agenda-skip-function 'bh/skip-project-tasks) - (org-agenda-todo-ignore-scheduled bh/hide-scheduled-and-waiting-next-tasks) - (org-agenda-todo-ignore-deadlines bh/hide-scheduled-and-waiting-next-tasks) - (org-agenda-todo-ignore-with-date bh/hide-scheduled-and-waiting-next-tasks) - (org-agenda-sorting-strategy - '(category-keep)))) - )) - ("A" "Daily agenda and top priority tasks" - ( - (agenda "" ( - (org-agenda-overriding-header "š Today's agenda\n") - (org-agenda-span 1) - (org-deadline-warning-days 0) - (org-agenda-block-separator nil) - (org-scheduled-past-days 0) - ;; We don't need the `org-agenda-date-today' - ;; highlight because that only has a practical - ;; utility in multi-day views. - (org-agenda-day-face-function (lambda (date) 'org-agenda-date)) - (org-agenda-format-date "%A %-e %B %Y") - )) - - (agenda "" ( - (org-agenda-overriding-header "\nš Pending scheduled tasks") - (org-agenda-time-grid nil) - (org-agenda-start-on-weekday nil) - (org-agenda-span 1) - (org-agenda-show-all-dates nil) - (org-scheduled-past-days 365) - ;; Excludes today's scheduled items - (org-scheduled-delay-days 1) - (org-agenda-block-separator nil) - (org-agenda-entry-types '(:scheduled)) - (org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) - (org-agenda-day-face-function (lambda (date) 'org-agenda-date)) - (org-agenda-format-date "") - )) - - (agenda "" ( - (org-agenda-overriding-header "\nā° Next three days\n") - (org-agenda-start-on-weekday nil) - (org-agenda-start-day nil) - (org-agenda-start-day "+1d") - (org-agenda-span 3) - (org-deadline-warning-days 0) - (org-agenda-block-separator nil) - (org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) - )) - - (agenda "" ( - (org-agenda-overriding-header "\nš Upcoming deadlines (+14d)\n") - (org-agenda-time-grid nil) - (org-agenda-start-on-weekday nil) - ;; We don't want to replicate the previous section's - ;; three days, so we start counting from the day after. - (org-agenda-start-day "+4d") - (org-agenda-span 14) - (org-agenda-show-all-dates nil) - (org-deadline-warning-days 0) - (org-agenda-entry-types '(:deadline)) - (org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) - )) - - (tags-todo "*" - ( - (org-agenda-overriding-header "\nš¤ Important tasks without a date") - (org-agenda-skip-function '(org-agenda-skip-if nil '(timestamp))) - (org-agenda-skip-function - `(org-agenda-skip-entry-if - 'notregexp ,(format "\\[#%s\\]" (char-to-string org-priority-highest)))) - (org-agenda-block-separator nil) - )) - - (tags-todo "REFILE" - ((org-agenda-overriding-header "\nā Tasks to Refile") - (org-agenda-block-separator nil) - )) - - - (tags-todo "-HOLD-CANCELLED/!" - ((org-agenda-overriding-header "\nš« Stuck Projects") - (org-agenda-skip-function 'bh/skip-non-stuck-projects) - (org-agenda-block-separator nil) - (org-agenda-sorting-strategy - '(category-keep)))) - )) - )) - -(setq org-agenda-files my-org-agenda-files) -(setq org-agenda-custom-commands my-org-agenda-custom-commands) - -;; Do not dim blocked tasks -(setq org-agenda-compact-blocks nil) -(setq org-agenda-dim-blocked-tasks nil) -(setq org-agenda-block-separator 61) - (defun bh/is-project-p () "Any task with a todo keyword subtask" (save-restriction @@ -662,9 +498,6 @@ as the default task." (setq org-global-properties (quote (("Effort_ALL" . "0:15 0:30 0:45 1:00 2:00 3:00 4:00 5:00 6:00 0:00") ("STYLE_ALL" . "habit")))) -;; Agenda log mode items to display (closed and state changes by default) -(setq org-agenda-log-mode-items (quote (closed state))) - ;; TAGS ;; ; Tags with fast selection keys (setq org-tag-alist (quote ((:startgroup) @@ -688,28 +521,8 @@ as the default task." ; Allow setting single tags without the menu (setq org-fast-tag-selection-single-key (quote expert)) -; For tag searches ignore tasks with scheduled and deadline dates -(setq org-agenda-tags-todo-honor-ignore-options t) - ;; org-modern (add-hook 'org-mode-hook 'org-modern-mode) (add-hook 'org-agenda-finalize-hook #'org-modern-agenda) -;; Credits: https://200ok.ch/posts/2022-02-13_integrating_org_mode_agenda_into_other_calendar_apps.html -(defun org-agenda-export-to-ics () - (set-org-agenda-files) - ;; Run all custom agenda commands that have a file argument. - (org-batch-store-agenda-views) - - ;; Org mode correctly exports TODO keywords as VTODO events in ICS. - ;; However, some proprietary calendars do not really work with - ;; standards (looking at you Google), so VTODO is ignored and only - ;; VEVENT is read. - (with-current-buffer (find-file-noselect org-agenda-private-local-path) - (goto-char (point-min)) - (while (re-search-forward "VTODO" nil t) - (replace-match "VEVENT")) - (save-buffer)) - - ;; Copy the ICS file to a remote server (Tramp paths work). - (copy-file org-agenda-private-local-path org-agenda-private-remote-path t)) +(provide 'rul-org) |