From 9a8a2096303c702f86f5175cb332e0938dd420d0 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 13 May 2026 20:14:41 -0500 Subject: feat(org-agenda): add VERIFICATION and IN-PROGRESS blocks around SCHEDULE The main "d" agenda view grows two new blocks. A VERIFICATION block lists tasks in the VERIFY TODO state, placed just above the day's SCHEDULE. An IN-PROGRESS block lists tasks in the DOING TODO state, placed just under SCHEDULE. The full block order is now: OVERDUE -> HIGH PRIORITY -> VERIFICATION -> SCHEDULE -> IN-PROGRESS -> PRIORITY B. Scope matches the other blocks (every entry in `org-agenda-files`). Scheduled and deadlined entries are included -- a VERIFY task with a date appears in both VERIFICATION and SCHEDULE, mirroring how HIGH PRIORITY behaves. Habits are skipped via `cj/org-skip-subtree-if-habit`; PROJECT-keyword parents wouldn't match `(todo "VERIFY")` exact-state filters anyway, so no extra skip there. Two new header defvars (`cj/main-agenda-verify-title`, `cj/main-agenda-doing-title`) for symmetry with the existing four. Both blocks reference the shared `cj/--main-agenda-prefix-format` so a format tweak still lands in one place. Five new tests in `test-org-agenda-config-skip-functions.el` lock the block order, each new block's header / prefix-format / skip-function, and the include-scheduled-entries contract. --- tests/test-org-agenda-config-skip-functions.el | 86 ++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) (limited to 'tests') diff --git a/tests/test-org-agenda-config-skip-functions.el b/tests/test-org-agenda-config-skip-functions.el index 3c044adb..aec1e71b 100644 --- a/tests/test-org-agenda-config-skip-functions.el +++ b/tests/test-org-agenda-config-skip-functions.el @@ -264,5 +264,91 @@ regression where one block diverges from the others on the format." (fmt-form (cadr (assoc 'org-agenda-prefix-format opts)))) (should (eq fmt-form 'cj/--main-agenda-prefix-format)))))) +;;; ---------- VERIFICATION and IN-PROGRESS blocks ---------- + +;;; Normal Cases + +(ert-deftest test-org-agenda-config-d-command-has-six-blocks-in-expected-order () + "Normal: the \"d\" command runs six blocks in the expected order -- +OVERDUE -> HIGH PRIORITY -> VERIFICATION -> SCHEDULE -> IN-PROGRESS -> PRIORITY B." + (let* ((entry (assoc "d" org-agenda-custom-commands)) + (blocks (nth 2 entry)) + (shapes (mapcar (lambda (b) (list (car b) (cadr b))) blocks))) + (should (equal shapes + '((alltodo "") + (tags "PRIORITY=\"A\"") + (todo "VERIFY") + (agenda "") + (todo "DOING") + (alltodo "")))))) + +(ert-deftest test-org-agenda-config-verify-block-options () + "Normal: the VERIFY block carries the VERIFICATION header, the shared +prefix format, and the habit skip function." + (let* ((entry (assoc "d" org-agenda-custom-commands)) + (blocks (nth 2 entry)) + (verify (seq-find + (lambda (b) (and (eq (car b) 'todo) + (equal (cadr b) "VERIFY"))) + blocks)) + (opts (nth 2 verify))) + (should verify) + (should (eq (cadr (assoc 'org-agenda-overriding-header opts)) + 'cj/main-agenda-verify-title)) + (should (equal cj/main-agenda-verify-title "VERIFICATION")) + (should (eq (cadr (assoc 'org-agenda-prefix-format opts)) + 'cj/--main-agenda-prefix-format)) + (should (equal (cadr (assoc 'org-agenda-skip-function opts)) + ''cj/org-skip-subtree-if-habit)))) + +(ert-deftest test-org-agenda-config-doing-block-options () + "Normal: the DOING block carries the IN-PROGRESS header, the shared +prefix format, and the habit skip function." + (let* ((entry (assoc "d" org-agenda-custom-commands)) + (blocks (nth 2 entry)) + (doing (seq-find + (lambda (b) (and (eq (car b) 'todo) + (equal (cadr b) "DOING"))) + blocks)) + (opts (nth 2 doing))) + (should doing) + (should (eq (cadr (assoc 'org-agenda-overriding-header opts)) + 'cj/main-agenda-doing-title)) + (should (equal cj/main-agenda-doing-title "IN-PROGRESS")) + (should (eq (cadr (assoc 'org-agenda-prefix-format opts)) + 'cj/--main-agenda-prefix-format)) + (should (equal (cadr (assoc 'org-agenda-skip-function opts)) + ''cj/org-skip-subtree-if-habit)))) + +;;; Boundary Cases + +(ert-deftest test-org-agenda-config-verify-block-includes-scheduled-entries () + "Boundary: the VERIFY block has no scheduled/deadline skip, so a VERIFY +task with a scheduled date appears here as well as in the SCHEDULE block. +Mirrors the HIGH PRIORITY block's behaviour." + (let* ((entry (assoc "d" org-agenda-custom-commands)) + (blocks (nth 2 entry)) + (verify (seq-find + (lambda (b) (and (eq (car b) 'todo) + (equal (cadr b) "VERIFY"))) + blocks)) + (opts (nth 2 verify)) + (skip (cadr (assoc 'org-agenda-skip-function opts)))) + ;; Single skip function (no compound `or' with scheduled/deadline). + (should (equal skip ''cj/org-skip-subtree-if-habit)))) + +(ert-deftest test-org-agenda-config-doing-block-includes-scheduled-entries () + "Boundary: same contract as VERIFY -- no scheduled/deadline skip, so a +DOING task with a scheduled date appears in both blocks." + (let* ((entry (assoc "d" org-agenda-custom-commands)) + (blocks (nth 2 entry)) + (doing (seq-find + (lambda (b) (and (eq (car b) 'todo) + (equal (cadr b) "DOING"))) + blocks)) + (opts (nth 2 doing)) + (skip (cadr (assoc 'org-agenda-skip-function opts)))) + (should (equal skip ''cj/org-skip-subtree-if-habit)))) + (provide 'test-org-agenda-config-skip-functions) ;;; test-org-agenda-config-skip-functions.el ends here -- cgit v1.2.3