Fixed TODO in org-mode, made things more modular

This commit is contained in:
Roger Gonzalez 2025-03-30 12:18:52 -03:00
parent 2f34baa5b7
commit 2941c5cfd4
Signed by: rogs
GPG Key ID: C7ECE9C6C36EC2E6
2 changed files with 240 additions and 144 deletions

View File

@ -24,6 +24,24 @@
(after! org (after! org
;; Include diary ;; Include diary
(setq org-agenda-include-diary t) (setq org-agenda-include-diary t)
;; Enforce ordered tasks
(setq org-enforce-todo-dependencies t)
(setq org-enforce-todo-checkbox-dependencies t)
(setq org-track-ordered-property-with-tag t)
;; Text formatting
(add-hook 'org-mode-hook #'auto-fill-mode)
(setq-default fill-column 105)
;; Save all org buffers on each save
(add-hook 'auto-save-hook 'org-save-all-org-buffers)
(add-hook 'after-save-hook 'org-save-all-org-buffers)
(require 'org-download)
(add-hook 'dired-mode-hook 'org-download-enable)
(add-hook 'org-mode-hook 'org-auto-tangle-mode))
(after! org
;; Logs ;; Logs
(setq org-log-state-notes-insert-after-drawers nil (setq org-log-state-notes-insert-after-drawers nil
org-log-into-drawer "LOGBOOK" org-log-into-drawer "LOGBOOK"
@ -31,60 +49,84 @@
org-log-repeat 'time org-log-repeat 'time
org-log-redeadline 'note org-log-redeadline 'note
org-log-reschedule 'note) org-log-reschedule 'note)
;; Keyword and faces
;; TODO keywords and states
(setq-default org-todo-keywords (setq-default org-todo-keywords
'((sequence "REPEAT(r)" "NEXT(n@/!)" "DELEGATED(e@/!)" "TODO(t@/!)" "WAITING(w@/!)" "SOMEDAY(s@/!)" "PROJ(p)" "|" "DONE(d@)" "CANCELLED(c@/!)" "FORWARDED(f@)"))) '((sequence "REPEAT(r)" "NEXT(n@/!)" "DELEGATED(e@/!)" "TODO(t@/!)"
(setq-default org-todo-keyword-faces "WAITING(w@/!)" "SOMEDAY(s@/!)" "PROJ(p)" "|"
'( "DONE(d@)" "CANCELLED(c@/!)" "FORWARDED(f@)")))
( "REPEAT" . (:foreground "white" :background "indigo" :weight bold))
( "NEXT" . (:foreground "red" :background "orange" :weight bold)) ;; Priorities configuration
( "DELEGATED" . (:foreground "white" :background "blue" :weight bold))
( "TODO" . (:foreground "white" :background "violet" :weight bold))
( "WAITING" (:foreground "white" :background "#A9BE00" :weight bold))
( "SOMEDAY" . (:foreground "white" :background "#00807E" :weight bold))
( "PROJ" . (:foreground "white" :background "deeppink3" :weight bold))
( "DONE" . (:foreground "white" :background "forest green" :weight bold))
( "CANCELLED" . (:foreground "light gray" :slant italic))
( "FORWARDED" . (:foreground "light gray" :slant italic))
))
(setq org-fontify-done-headline t)
(setq org-fontify-todo-headline t)
;; Priorities
;; A: Do it now ;; A: Do it now
;; B: Decide when to do it ;; B: Decide when to do it
;; C: Delegate it ;; C: Delegate it
;; D: Just an idea ;; D: Just an idea
(setq org-highest-priority ?A) (setq org-highest-priority ?A)
(setq org-lowest-priority ?D) (setq org-lowest-priority ?D)
(setq org-default-priority ?B) (setq org-default-priority ?B))
(after! org
;; TODO keyword faces
(setq-default org-todo-keyword-faces
'(("REPEAT" . (:foreground "white" :background "indigo" :weight bold))
("NEXT" . (:foreground "red" :background "orange" :weight bold))
("DELEGATED" . (:foreground "white" :background "blue" :weight bold))
("TODO" . (:foreground "white" :background "violet" :weight bold))
("WAITING" (:foreground "white" :background "#A9BE00" :weight bold))
("SOMEDAY" . (:foreground "white" :background "#00807E" :weight bold))
("PROJ" . (:foreground "white" :background "deeppink3" :weight bold))
("DONE" . (:foreground "white" :background "forest green" :weight bold))
("CANCELLED" . (:foreground "light gray" :slant italic))
("FORWARDED" . (:foreground "light gray" :slant italic))))
;; Priority faces
(setq org-priority-faces '((?A . (:foreground "white" :background "dark red" :weight bold)) (setq org-priority-faces '((?A . (:foreground "white" :background "dark red" :weight bold))
(?B . (:foreground "white" :background "dark green" :weight bold)) (?B . (:foreground "white" :background "dark green" :weight bold))
(?C . (:foreground "yellow")) (?C . (:foreground "yellow"))
(?D . (:foreground "gray")))) (?D . (:foreground "gray"))))
;; Capture templates
;; Headline styling
(setq org-fontify-done-headline t)
(setq org-fontify-todo-headline t)
;; Org bullets for prettier headings
(require 'org-bullets)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
(after! org
(setq org-capture-templates (setq org-capture-templates
(quote (quote
( (("G" "Define a goal" entry (file+headline "~/org/capture.org" "Capture")
("G" "Define a goal" entry (file+headline "~/org/capture.org" "Capture") (file "~/org/templates/goal.org") :empty-lines-after 1) (file "~/org/templates/goal.org") :empty-lines-after 1)
("R" "REPEAT entry" entry (file+headline "~/org/capture.org" "Capture") (file "~/org/templates/repeat.org") :empty-lines-before 1) ("R" "REPEAT entry" entry (file+headline "~/org/capture.org" "Capture")
("N" "NEXT entry" entry (file+headline "~/org/capture.org" "Capture") (file "~/org/templates/next.org") :empty-lines-before 1) (file "~/org/templates/repeat.org") :empty-lines-before 1)
("T" "TODO entry" entry (file+headline "~/org/capture.org" "Capture") (file "~/org/templates/todo.org") :empty-lines-before 1) ("N" "NEXT entry" entry (file+headline "~/org/capture.org" "Capture")
("W" "WAITING entry" entry (file+headline "~/org/capture.org" "Capture") (file "~/org/templates/waiting.org") :empty-lines-before 1) (file "~/org/templates/next.org") :empty-lines-before 1)
("S" "SOMEDAY entry" entry (file+headline "~/org/capture.org" "Capture") (file "~/org/templates/someday.org") :empty-lines-before 1) ("T" "TODO entry" entry (file+headline "~/org/capture.org" "Capture")
("P" "PROJ entry" entry (file+headline "~/org/capture.org" "Capture") (file "~/org/templates/proj.org") :empty-lines-before 1) (file "~/org/templates/todo.org") :empty-lines-before 1)
("B" "Book on the to-read-list" entry (file+headline "~/org/private.org" "Libros para leer") (file "~/org/templates/book.org") :empty-lines-after 2) ("W" "WAITING entry" entry (file+headline "~/org/capture.org" "Capture")
(file "~/org/templates/waiting.org") :empty-lines-before 1)
("S" "SOMEDAY entry" entry (file+headline "~/org/capture.org" "Capture")
(file "~/org/templates/someday.org") :empty-lines-before 1)
("P" "PROJ entry" entry (file+headline "~/org/capture.org" "Capture")
(file "~/org/templates/proj.org") :empty-lines-before 1)
("B" "Book on the to-read-list" entry (file+headline "~/org/private.org" "Libros para leer")
(file "~/org/templates/book.org") :empty-lines-after 2)
("p" "Create a daily plan") ("p" "Create a daily plan")
("pP" "Daily plan private" plain (file+olp+datetree "~/org/plan-free.org") (file "~/org/templates/dailyplan.org") :immediate-finish t :jump-to-captured t) ("pP" "Daily plan private" plain (file+olp+datetree "~/org/plan-free.org")
("pL" "Daily plan Lazer" plain (file+olp+datetree "~/org/plan-lazer.org") (file "~/org/templates/dailyplan.org") :immediate-finish t :jump-to-captured t) (file "~/org/templates/dailyplan.org") :immediate-finish t :jump-to-captured t)
("pL" "Daily plan Lazer" plain (file+olp+datetree "~/org/plan-lazer.org")
(file "~/org/templates/dailyplan.org") :immediate-finish t :jump-to-captured t)
("j" "Journal entry") ("j" "Journal entry")
("jP" "Journal entry private" entry (file+olp+datetree "~/org/journal-private.org") "** %U - %^{Heading}") ("jP" "Journal entry private" entry (file+olp+datetree "~/org/journal-private.org")
("jL" "Journal entry Lazer" entry (file+olp+datetree "~/org/journal-lazer.org") "** %U - %^{Heading}") "** %U - %^{Heading}")
))) ("jL" "Journal entry Lazer" entry (file+olp+datetree "~/org/journal-lazer.org")
;; Custom agenda views "** %U - %^{Heading}")))))
(after! org
(setq org-agenda-custom-commands (setq org-agenda-custom-commands
(quote (quote
( (("A" . "Agendas")
("A" . "Agendas")
("AT" "Daily overview" ("AT" "Daily overview"
((tags-todo "URGENT" ((tags-todo "URGENT"
((org-agenda-overriding-header "Urgent Tasks"))) ((org-agenda-overriding-header "Urgent Tasks")))
@ -133,43 +175,28 @@
(quote (quote
(org-agenda-skip-entry-if (org-agenda-skip-entry-if
(quote scheduled) (quote scheduled)
(quote deadline))))))) (quote deadline))))))))))
))
;;
;; Enforce ordered tasks
(setq org-enforce-todo-dependencies t)
(setq org-enforce-todo-checkbox-dependencies t)
(setq org-track-ordered-property-with-tag t)
;; Org bullets (after! org
(require 'org-bullets)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
;; Org recur
;; Load org-recur ;; Load org-recur
(require 'org-recur) (require 'org-recur)
(after! org-recur (after! org-recur
(add-hook 'org-mode-hook #'org-recur-mode) (add-hook 'org-mode-hook #'org-recur-mode)
(add-hook 'org-agenda-mode-hook #'org-recur-agenda-mode) (add-hook 'org-agenda-mode-hook #'org-recur-agenda-mode)
(map! :map org-recur-mode-map (map! :map org-recur-mode-map
"C-c d" #'org-recur-finish) "C-c d" #'org-recur-finish)
(map! :map org-recur-agenda-mode-map (map! :map org-recur-agenda-mode-map
"C-c d" #'org-recur-finish "C-c d" #'org-recur-finish
"C-c 0" #'org-recur-schedule-today) "C-c 0" #'org-recur-schedule-today)
(setq org-recur-finish-done t (setq org-recur-finish-done t
org-recur-finish-archive t)) org-recur-finish-archive t)))
;; Truncate lines to 105 chars (after! org
;; Why 105 chars? Because that's the max my screen can handle on vertical split ;; Refresh org-agenda after rescheduling a task
(add-hook 'org-mode-hook #'auto-fill-mode)
(setq-default fill-column 105)
;; Custom ORG functions
;; Refresh org-agenda after rescheduling a task.
(defun org-agenda-refresh () (defun org-agenda-refresh ()
"Refresh all `org-agenda' buffers more efficiently." "Refresh all `org-agenda' buffers more efficiently."
(let ((agenda-buffers (seq-filter (let ((agenda-buffers (seq-filter
@ -185,6 +212,7 @@
"Refresh org-agenda." "Refresh org-agenda."
(org-agenda-refresh)) (org-agenda-refresh))
;; Focus functions
(defun org-focus (files msg) (defun org-focus (files msg)
"Set focus on specific org FILES with notification MSG." "Set focus on specific org FILES with notification MSG."
(setq org-agenda-files files) (setq org-agenda-files files)
@ -205,6 +233,7 @@
(interactive) (interactive)
(org-focus '("~/org/") "Focusing on all Org files")) (org-focus '("~/org/") "Focusing on all Org files"))
;; ID management
(defun my/org-add-ids-to-headlines-in-file () (defun my/org-add-ids-to-headlines-in-file ()
"Add ID properties to all headlines in the current file which "Add ID properties to all headlines in the current file which
do not already have one." do not already have one."
@ -215,6 +244,7 @@ do not already have one."
(lambda () (lambda ()
(add-hook 'before-save-hook (add-hook 'before-save-hook
'my/org-add-ids-to-headlines-in-file nil 'local))) 'my/org-add-ids-to-headlines-in-file nil 'local)))
(defun my/copy-idlink-to-clipboard () (defun my/copy-idlink-to-clipboard ()
"Copy an ID link with the headline to killring. "Copy an ID link with the headline to killring.
If no ID exists, create a new unique ID. This function works only in If no ID exists, create a new unique ID. This function works only in
@ -241,6 +271,7 @@ related notes or tasks."
(global-set-key (kbd "<f5>") 'my/copy-idlink-to-clipboard) (global-set-key (kbd "<f5>") 'my/copy-idlink-to-clipboard)
;; Checkbox handling
(defun org-reset-checkbox-state-maybe () (defun org-reset-checkbox-state-maybe ()
"Reset all checkboxes in an entry if the `RESET_CHECK_BOXES' property is set." "Reset all checkboxes in an entry if the `RESET_CHECK_BOXES' property is set."
(interactive "*") (interactive "*")
@ -253,6 +284,7 @@ related notes or tasks."
(add-hook 'org-after-todo-state-change-hook 'org-checklist) (add-hook 'org-after-todo-state-change-hook 'org-checklist)
;; Org-roam functions
(defun org-roam-node-insert-immediate (arg &rest args) (defun org-roam-node-insert-immediate (arg &rest args)
"Insert a node immediately without the capture process." "Insert a node immediately without the capture process."
(interactive "P") (interactive "P")
@ -260,14 +292,7 @@ related notes or tasks."
(org-roam-capture-templates (org-roam-capture-templates
(list (append (car org-roam-capture-templates) (list (append (car org-roam-capture-templates)
'(:immediate-finish t))))) '(:immediate-finish t)))))
(apply #'org-roam-node-insert args))) (apply #'org-roam-node-insert args))))
;; Save all org buffers on each save
(add-hook 'auto-save-hook 'org-save-all-org-buffers)
(add-hook 'after-save-hook 'org-save-all-org-buffers)
(require 'org-download)
(add-hook 'dired-mode-hook 'org-download-enable)
(add-hook 'org-mode-hook 'org-auto-tangle-mode))
(after! lsp-mode (after! lsp-mode
(setq lsp-headerline-breadcrumb-enable t) (setq lsp-headerline-breadcrumb-enable t)

View File

@ -95,25 +95,44 @@ The setup includes custom agenda views, capture templates, and todo states that
(setq org-roam-directory "~/roam/") (setq org-roam-directory "~/roam/")
#+end_src #+end_src
** Configuration ** Basic Org Setup
:PROPERTIES: :PROPERTIES:
:ID: 37915445-e875-4da0-bab0-3f8f8b8e89f5 :ID: 37915445-e875-4da0-bab0-3f8f8b8e89f5
:END: :END:
This is the core Org-mode configuration that implements my personal productivity system. It includes: This section contains the foundational settings for Org mode, including directory paths and basic behavior.
- Custom TODO keywords that reflect my workflow states (NEXT, WAITING, SOMEDAY, etc.)
- Visual styling for different task states and priorities
- Capture templates for quickly adding different types of content
- Custom agenda views for different perspectives on my tasks
- Recurring task handling with org-recur
TODO: Breakup this section into smaller, more focused components later
#+begin_src emacs-lisp #+begin_src emacs-lisp
(after! org (after! org
;; Include diary ;; Include diary
(setq org-agenda-include-diary t) (setq org-agenda-include-diary t)
;; Enforce ordered tasks
(setq org-enforce-todo-dependencies t)
(setq org-enforce-todo-checkbox-dependencies t)
(setq org-track-ordered-property-with-tag t)
;; Text formatting
(add-hook 'org-mode-hook #'auto-fill-mode)
(setq-default fill-column 105)
;; Save all org buffers on each save
(add-hook 'auto-save-hook 'org-save-all-org-buffers)
(add-hook 'after-save-hook 'org-save-all-org-buffers)
(require 'org-download)
(add-hook 'dired-mode-hook 'org-download-enable)
(add-hook 'org-mode-hook 'org-auto-tangle-mode))
#+end_src
** Task Management
:PROPERTIES:
:ID: 37915445-e875-4da0-bab0-3f8f8b8e89f6
:END:
Configuration for task tracking, including TODO keywords, priorities, and logging behavior.
#+begin_src emacs-lisp
(after! org
;; Logs ;; Logs
(setq org-log-state-notes-insert-after-drawers nil (setq org-log-state-notes-insert-after-drawers nil
org-log-into-drawer "LOGBOOK" org-log-into-drawer "LOGBOOK"
@ -121,60 +140,111 @@ TODO: Breakup this section into smaller, more focused components later
org-log-repeat 'time org-log-repeat 'time
org-log-redeadline 'note org-log-redeadline 'note
org-log-reschedule 'note) org-log-reschedule 'note)
;; Keyword and faces
;; TODO keywords and states
(setq-default org-todo-keywords (setq-default org-todo-keywords
'((sequence "REPEAT(r)" "NEXT(n@/!)" "DELEGATED(e@/!)" "TODO(t@/!)" "WAITING(w@/!)" "SOMEDAY(s@/!)" "PROJ(p)" "|" "DONE(d@)" "CANCELLED(c@/!)" "FORWARDED(f@)"))) '((sequence "REPEAT(r)" "NEXT(n@/!)" "DELEGATED(e@/!)" "TODO(t@/!)"
(setq-default org-todo-keyword-faces "WAITING(w@/!)" "SOMEDAY(s@/!)" "PROJ(p)" "|"
'( "DONE(d@)" "CANCELLED(c@/!)" "FORWARDED(f@)")))
( "REPEAT" . (:foreground "white" :background "indigo" :weight bold))
( "NEXT" . (:foreground "red" :background "orange" :weight bold)) ;; Priorities configuration
( "DELEGATED" . (:foreground "white" :background "blue" :weight bold))
( "TODO" . (:foreground "white" :background "violet" :weight bold))
( "WAITING" (:foreground "white" :background "#A9BE00" :weight bold))
( "SOMEDAY" . (:foreground "white" :background "#00807E" :weight bold))
( "PROJ" . (:foreground "white" :background "deeppink3" :weight bold))
( "DONE" . (:foreground "white" :background "forest green" :weight bold))
( "CANCELLED" . (:foreground "light gray" :slant italic))
( "FORWARDED" . (:foreground "light gray" :slant italic))
))
(setq org-fontify-done-headline t)
(setq org-fontify-todo-headline t)
;; Priorities
;; A: Do it now ;; A: Do it now
;; B: Decide when to do it ;; B: Decide when to do it
;; C: Delegate it ;; C: Delegate it
;; D: Just an idea ;; D: Just an idea
(setq org-highest-priority ?A) (setq org-highest-priority ?A)
(setq org-lowest-priority ?D) (setq org-lowest-priority ?D)
(setq org-default-priority ?B) (setq org-default-priority ?B))
#+end_src
** Visual Styling
:PROPERTIES:
:ID: 37915445-e875-4da0-bab0-3f8f8b8e89f7
:END:
Visual appearance settings for Org mode, including fonts, colors, and formatting.
#+begin_src emacs-lisp
(after! org
;; TODO keyword faces
(setq-default org-todo-keyword-faces
'(("REPEAT" . (:foreground "white" :background "indigo" :weight bold))
("NEXT" . (:foreground "red" :background "orange" :weight bold))
("DELEGATED" . (:foreground "white" :background "blue" :weight bold))
("TODO" . (:foreground "white" :background "violet" :weight bold))
("WAITING" (:foreground "white" :background "#A9BE00" :weight bold))
("SOMEDAY" . (:foreground "white" :background "#00807E" :weight bold))
("PROJ" . (:foreground "white" :background "deeppink3" :weight bold))
("DONE" . (:foreground "white" :background "forest green" :weight bold))
("CANCELLED" . (:foreground "light gray" :slant italic))
("FORWARDED" . (:foreground "light gray" :slant italic))))
;; Priority faces
(setq org-priority-faces '((?A . (:foreground "white" :background "dark red" :weight bold)) (setq org-priority-faces '((?A . (:foreground "white" :background "dark red" :weight bold))
(?B . (:foreground "white" :background "dark green" :weight bold)) (?B . (:foreground "white" :background "dark green" :weight bold))
(?C . (:foreground "yellow")) (?C . (:foreground "yellow"))
(?D . (:foreground "gray")))) (?D . (:foreground "gray"))))
;; Capture templates
;; Headline styling
(setq org-fontify-done-headline t)
(setq org-fontify-todo-headline t)
;; Org bullets for prettier headings
(require 'org-bullets)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
#+end_src
** Capture Templates
:PROPERTIES:
:ID: 37915445-e875-4da0-bab0-3f8f8b8e89f8
:END:
Templates for quickly capturing various types of information into Org mode.
#+begin_src emacs-lisp
(after! org
(setq org-capture-templates (setq org-capture-templates
(quote (quote
( (("G" "Define a goal" entry (file+headline "~/org/capture.org" "Capture")
("G" "Define a goal" entry (file+headline "~/org/capture.org" "Capture") (file "~/org/templates/goal.org") :empty-lines-after 1) (file "~/org/templates/goal.org") :empty-lines-after 1)
("R" "REPEAT entry" entry (file+headline "~/org/capture.org" "Capture") (file "~/org/templates/repeat.org") :empty-lines-before 1) ("R" "REPEAT entry" entry (file+headline "~/org/capture.org" "Capture")
("N" "NEXT entry" entry (file+headline "~/org/capture.org" "Capture") (file "~/org/templates/next.org") :empty-lines-before 1) (file "~/org/templates/repeat.org") :empty-lines-before 1)
("T" "TODO entry" entry (file+headline "~/org/capture.org" "Capture") (file "~/org/templates/todo.org") :empty-lines-before 1) ("N" "NEXT entry" entry (file+headline "~/org/capture.org" "Capture")
("W" "WAITING entry" entry (file+headline "~/org/capture.org" "Capture") (file "~/org/templates/waiting.org") :empty-lines-before 1) (file "~/org/templates/next.org") :empty-lines-before 1)
("S" "SOMEDAY entry" entry (file+headline "~/org/capture.org" "Capture") (file "~/org/templates/someday.org") :empty-lines-before 1) ("T" "TODO entry" entry (file+headline "~/org/capture.org" "Capture")
("P" "PROJ entry" entry (file+headline "~/org/capture.org" "Capture") (file "~/org/templates/proj.org") :empty-lines-before 1) (file "~/org/templates/todo.org") :empty-lines-before 1)
("B" "Book on the to-read-list" entry (file+headline "~/org/private.org" "Libros para leer") (file "~/org/templates/book.org") :empty-lines-after 2) ("W" "WAITING entry" entry (file+headline "~/org/capture.org" "Capture")
(file "~/org/templates/waiting.org") :empty-lines-before 1)
("S" "SOMEDAY entry" entry (file+headline "~/org/capture.org" "Capture")
(file "~/org/templates/someday.org") :empty-lines-before 1)
("P" "PROJ entry" entry (file+headline "~/org/capture.org" "Capture")
(file "~/org/templates/proj.org") :empty-lines-before 1)
("B" "Book on the to-read-list" entry (file+headline "~/org/private.org" "Libros para leer")
(file "~/org/templates/book.org") :empty-lines-after 2)
("p" "Create a daily plan") ("p" "Create a daily plan")
("pP" "Daily plan private" plain (file+olp+datetree "~/org/plan-free.org") (file "~/org/templates/dailyplan.org") :immediate-finish t :jump-to-captured t) ("pP" "Daily plan private" plain (file+olp+datetree "~/org/plan-free.org")
("pL" "Daily plan Lazer" plain (file+olp+datetree "~/org/plan-lazer.org") (file "~/org/templates/dailyplan.org") :immediate-finish t :jump-to-captured t) (file "~/org/templates/dailyplan.org") :immediate-finish t :jump-to-captured t)
("pL" "Daily plan Lazer" plain (file+olp+datetree "~/org/plan-lazer.org")
(file "~/org/templates/dailyplan.org") :immediate-finish t :jump-to-captured t)
("j" "Journal entry") ("j" "Journal entry")
("jP" "Journal entry private" entry (file+olp+datetree "~/org/journal-private.org") "** %U - %^{Heading}") ("jP" "Journal entry private" entry (file+olp+datetree "~/org/journal-private.org")
("jL" "Journal entry Lazer" entry (file+olp+datetree "~/org/journal-lazer.org") "** %U - %^{Heading}") "** %U - %^{Heading}")
))) ("jL" "Journal entry Lazer" entry (file+olp+datetree "~/org/journal-lazer.org")
;; Custom agenda views "** %U - %^{Heading}")))))
#+end_src
** Agenda Views
:PROPERTIES:
:ID: 37915445-e875-4da0-bab0-3f8f8b8e89f9
:END:
Custom agenda views for different perspectives on tasks and events.
#+begin_src emacs-lisp
(after! org
(setq org-agenda-custom-commands (setq org-agenda-custom-commands
(quote (quote
( (("A" . "Agendas")
("A" . "Agendas")
("AT" "Daily overview" ("AT" "Daily overview"
((tags-todo "URGENT" ((tags-todo "URGENT"
((org-agenda-overriding-header "Urgent Tasks"))) ((org-agenda-overriding-header "Urgent Tasks")))
@ -223,43 +293,46 @@ TODO: Breakup this section into smaller, more focused components later
(quote (quote
(org-agenda-skip-entry-if (org-agenda-skip-entry-if
(quote scheduled) (quote scheduled)
(quote deadline))))))) (quote deadline))))))))))
)) #+end_src
;;
;; Enforce ordered tasks
(setq org-enforce-todo-dependencies t)
(setq org-enforce-todo-checkbox-dependencies t)
(setq org-track-ordered-property-with-tag t)
;; Org bullets ** Org Recur
(require 'org-bullets) :PROPERTIES:
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) :ID: 37915445-e875-4da0-bab0-3f8f8b8e8910
:END:
;; Org recur Configuration for handling recurring tasks with org-recur.
#+begin_src emacs-lisp
(after! org
;; Load org-recur ;; Load org-recur
(require 'org-recur) (require 'org-recur)
(after! org-recur (after! org-recur
(add-hook 'org-mode-hook #'org-recur-mode) (add-hook 'org-mode-hook #'org-recur-mode)
(add-hook 'org-agenda-mode-hook #'org-recur-agenda-mode) (add-hook 'org-agenda-mode-hook #'org-recur-agenda-mode)
(map! :map org-recur-mode-map (map! :map org-recur-mode-map
"C-c d" #'org-recur-finish) "C-c d" #'org-recur-finish)
(map! :map org-recur-agenda-mode-map (map! :map org-recur-agenda-mode-map
"C-c d" #'org-recur-finish "C-c d" #'org-recur-finish
"C-c 0" #'org-recur-schedule-today) "C-c 0" #'org-recur-schedule-today)
(setq org-recur-finish-done t (setq org-recur-finish-done t
org-recur-finish-archive t)) org-recur-finish-archive t)))
#+end_src
;; Truncate lines to 105 chars ** Custom Org Functions
;; Why 105 chars? Because that's the max my screen can handle on vertical split :PROPERTIES:
(add-hook 'org-mode-hook #'auto-fill-mode) :ID: 37915445-e875-4da0-bab0-3f8f8b8e8911
(setq-default fill-column 105) :END:
;; Custom ORG functions Custom functions to enhance Org mode functionality.
;; Refresh org-agenda after rescheduling a task.
#+begin_src emacs-lisp
(after! org
;; Refresh org-agenda after rescheduling a task
(defun org-agenda-refresh () (defun org-agenda-refresh ()
"Refresh all `org-agenda' buffers more efficiently." "Refresh all `org-agenda' buffers more efficiently."
(let ((agenda-buffers (seq-filter (let ((agenda-buffers (seq-filter
@ -275,6 +348,7 @@ TODO: Breakup this section into smaller, more focused components later
"Refresh org-agenda." "Refresh org-agenda."
(org-agenda-refresh)) (org-agenda-refresh))
;; Focus functions
(defun org-focus (files msg) (defun org-focus (files msg)
"Set focus on specific org FILES with notification MSG." "Set focus on specific org FILES with notification MSG."
(setq org-agenda-files files) (setq org-agenda-files files)
@ -295,6 +369,7 @@ TODO: Breakup this section into smaller, more focused components later
(interactive) (interactive)
(org-focus '("~/org/") "Focusing on all Org files")) (org-focus '("~/org/") "Focusing on all Org files"))
;; ID management
(defun my/org-add-ids-to-headlines-in-file () (defun my/org-add-ids-to-headlines-in-file ()
"Add ID properties to all headlines in the current file which "Add ID properties to all headlines in the current file which
do not already have one." do not already have one."
@ -305,6 +380,7 @@ do not already have one."
(lambda () (lambda ()
(add-hook 'before-save-hook (add-hook 'before-save-hook
'my/org-add-ids-to-headlines-in-file nil 'local))) 'my/org-add-ids-to-headlines-in-file nil 'local)))
(defun my/copy-idlink-to-clipboard () (defun my/copy-idlink-to-clipboard ()
"Copy an ID link with the headline to killring. "Copy an ID link with the headline to killring.
If no ID exists, create a new unique ID. This function works only in If no ID exists, create a new unique ID. This function works only in
@ -331,6 +407,7 @@ related notes or tasks."
(global-set-key (kbd "<f5>") 'my/copy-idlink-to-clipboard) (global-set-key (kbd "<f5>") 'my/copy-idlink-to-clipboard)
;; Checkbox handling
(defun org-reset-checkbox-state-maybe () (defun org-reset-checkbox-state-maybe ()
"Reset all checkboxes in an entry if the `RESET_CHECK_BOXES' property is set." "Reset all checkboxes in an entry if the `RESET_CHECK_BOXES' property is set."
(interactive "*") (interactive "*")
@ -343,6 +420,7 @@ related notes or tasks."
(add-hook 'org-after-todo-state-change-hook 'org-checklist) (add-hook 'org-after-todo-state-change-hook 'org-checklist)
;; Org-roam functions
(defun org-roam-node-insert-immediate (arg &rest args) (defun org-roam-node-insert-immediate (arg &rest args)
"Insert a node immediately without the capture process." "Insert a node immediately without the capture process."
(interactive "P") (interactive "P")
@ -350,14 +428,7 @@ related notes or tasks."
(org-roam-capture-templates (org-roam-capture-templates
(list (append (car org-roam-capture-templates) (list (append (car org-roam-capture-templates)
'(:immediate-finish t))))) '(:immediate-finish t)))))
(apply #'org-roam-node-insert args))) (apply #'org-roam-node-insert args))))
;; Save all org buffers on each save
(add-hook 'auto-save-hook 'org-save-all-org-buffers)
(add-hook 'after-save-hook 'org-save-all-org-buffers)
(require 'org-download)
(add-hook 'dired-mode-hook 'org-download-enable)
(add-hook 'org-mode-hook 'org-auto-tangle-mode))
#+end_src #+end_src
* Programming languages * Programming languages