diff options
| -rw-r--r-- | modules/org-agenda-config.el | 25 | ||||
| -rw-r--r-- | tests/test-org-agenda-config-skip-functions.el | 86 |
2 files changed, 108 insertions, 3 deletions
diff --git a/modules/org-agenda-config.el b/modules/org-agenda-config.el index 9ff2fd722..9e64a04bf 100644 --- a/modules/org-agenda-config.el +++ b/modules/org-agenda-config.el @@ -279,11 +279,22 @@ If the current buffer isn't an org buffer, inform the user." (defvar cj/main-agenda-tasks-title "PRIORITY B" "String to announce the schedule section of the main agenda.") +(defvar cj/main-agenda-verify-title "VERIFICATION" + "String to announce the VERIFY section of the main agenda. +Lists tasks in the VERIFY TODO state waiting on a manual check. +Block sits above the day's schedule.") + +(defvar cj/main-agenda-doing-title "IN-PROGRESS" + "String to announce the DOING section of the main agenda. +Lists tasks in the DOING TODO state -- work actively in flight. +Block sits just under the day's schedule.") + (defvar cj/--main-agenda-prefix-format " %i %-15:c%?-15t% s" "Prefix format string shared by all blocks of the main daily agenda. -Inlined across the overdue / high-priority / schedule / priority-B -blocks of `org-agenda-custom-commands' before the extraction. Keep -the four blocks pointing here so a format tweak lands in one place.") +Inlined across the overdue / high-priority / VERIFICATION / schedule / +IN-PROGRESS / priority-B blocks of `org-agenda-custom-commands' before +the extraction. Keep the six blocks pointing here so a format tweak +lands in one place.") (defun cj/org-skip-subtree-if-habit () "Skip an agenda entry if it has a STYLE property equal to \"habit\"." @@ -342,6 +353,10 @@ KEYWORDS must be a list of strings." ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) (org-agenda-overriding-header cj/main-agenda-hipri-title) (org-agenda-prefix-format cj/--main-agenda-prefix-format))) + (todo "VERIFY" + ((org-agenda-skip-function 'cj/org-skip-subtree-if-habit) + (org-agenda-overriding-header cj/main-agenda-verify-title) + (org-agenda-prefix-format cj/--main-agenda-prefix-format))) (agenda "" ((org-agenda-start-day "0d") (org-agenda-span 8) @@ -352,6 +367,10 @@ KEYWORDS must be a list of strings." '(org-agenda-skip-entry-if 'todo '("CANCELLED"))) (org-agenda-overriding-header cj/main-agenda-schedule-title) (org-agenda-prefix-format cj/--main-agenda-prefix-format))) + (todo "DOING" + ((org-agenda-skip-function 'cj/org-skip-subtree-if-habit) + (org-agenda-overriding-header cj/main-agenda-doing-title) + (org-agenda-prefix-format cj/--main-agenda-prefix-format))) (alltodo "" ((org-agenda-skip-function '(or (cj/org-skip-subtree-if-habit) (cj/org-skip-subtree-if-priority ?A) diff --git a/tests/test-org-agenda-config-skip-functions.el b/tests/test-org-agenda-config-skip-functions.el index 3c044adbd..aec1e71be 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 |
