Commit a57e9d5a706a

Vincent Demeester <vincent@sbr.pm>
2026-06-09 22:44:02
feat(emacs): refine org-agenda deadline visibility
Made deadlines a first-class planning signal in the daily agenda, following the deadline-first prioritization workflow. - Sorted deadline and scheduled items above timed entries. - Widened the daily "d" deadline warning window to 30 days for earlier planning, leaving the global default untouched. - Gave deadlines a dedicated leader glyph, keeping the red circle reserved for priority. - Showed the repeat cookie inline for recurring tasks, evaluating safely in both the source Org and agenda buffers.
1 parent cd11bc9
Changed files (1)
dots
config
emacs
dots/config/emacs/init.el
@@ -1762,7 +1762,7 @@ minibuffer, even without explicitly focusing it."
   (org-agenda-window-setup 'current-window)
   (org-agenda-sticky t)
   (org-agenda-sorting-strategy
-   '((agenda time-up deadline-up scheduled-up todo-state-up priority-down)
+   '((agenda deadline-up scheduled-up time-up todo-state-up priority-down)
      (todo todo-state-up priority-down deadline-up)
      (tags todo-state-up priority-down deadline-up)
      (search todo-state-up priority-down deadline-up)))
@@ -1796,7 +1796,7 @@ minibuffer, even without explicitly focusing it."
 		  ((org-agenda-overriding-header "๐Ÿ”ด High Priority")))
        (agenda ""
 	       ((org-agenda-span 'day)
-		(org-deadline-warning-days 5)
+		(org-deadline-warning-days 30)
 		(org-agenda-overriding-header "๐Ÿ“… Schedule & Deadlines")))
        (todo "NEXT"
 	     ((org-agenda-overriding-header "โžก๏ธ Focus (NEXT)")))))
@@ -1875,12 +1875,14 @@ minibuffer, even without explicitly focusing it."
 				    ("bike" ,(list (propertize "๐Ÿšดโ€โ™‚๏ธ")))
 				    ("security" ,(list (propertize "๐Ÿ›ก๏ธ")))
 				    ("i*" ,(list (propertize "๐Ÿ“’")))))
-  (org-agenda-prefix-format '((agenda . " %i %?-12t% s") ;; " %i %-12:c%?-12t%s%(my/org-agenda-repeater)"
+  (org-agenda-prefix-format '((agenda . " %i %?-12t%s%(my/org-agenda-repeater)")
 			      (todo . " %i")
 			      (tags . " %i")
 			      (search . " %i")))
-  ;; (org-agenda-scheduled-leaders '("Sched." "S.%2dx"))
-  ;; (org-agenda-deadline-leaders '("Deadl." "In%2dd" "D.%2dx"))
+  ;; Shorten scheduled leaders to free space for the repeater; give
+  ;; deadlines their own โณ glyph (๐Ÿ”ด stays reserved for priority).
+  (org-agenda-scheduled-leaders '("Sched " "S.%2dx "))
+  (org-agenda-deadline-leaders '("โณ 0d " "โณ%2dd " "โณ-%1dd "))
   (org-insert-heading-respect-content t)
   (org-M-RET-may-split-line '((default . nil)))
   (org-goto-interface 'outline-path-completion)
@@ -1925,13 +1927,18 @@ Works with any org link type. Creates a new tab, then opens the link."
         (tab-bar-new-tab)
         (org-open-at-point))))
 
-  (declare-function org-before-first-heading-p "org")
   (declare-function org-get-repeat "org")
   (defun my/org-agenda-repeater ()
-    "Return the repeater string for the current agenda entry."
-    (if (org-before-first-heading-p)
-	"-------"  ; Align with the time grid
-      (format "%5s: " (or (org-get-repeat) ""))))
+    "Return the repeat cookie (e.g. \"++1w\") for the current agenda entry.
+Evaluated by `org-agenda-format-item': for real items point sits on the
+heading in the source Org buffer; for grid lines it runs in the agenda
+buffer.  Show the repeater (so recurring tasks are visually distinct)
+only when present, and never call `org-element-at-point' outside an Org
+buffer."
+    (if (derived-mode-p 'org-mode)
+	(let ((rep (org-get-repeat)))
+	  (if rep (format "%-5s " rep) ""))
+      ""))
 
   (require 'dash)
   (require 's)