aboutsummaryrefslogtreecommitdiff
path: root/tests/test-org-agenda-config-skip-functions.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-13 13:04:50 -0500
committerCraig Jennings <c@cjennings.net>2026-05-13 13:04:50 -0500
commit8e579508a1e23e66513d2e8f97844d0eab2156d7 (patch)
treef430c3481e5423e863c6ade4c5410cc3a38333dd /tests/test-org-agenda-config-skip-functions.el
parent3f44db4f7be24c6daacad0956f019610aeb5f868 (diff)
downloaddotemacs-8e579508a1e23e66513d2e8f97844d0eab2156d7.tar.gz
dotemacs-8e579508a1e23e66513d2e8f97844d0eab2156d7.zip
fix(org-agenda): skip CANCELLED entries from main agenda SCHEDULE
The "d" command's (agenda ...) block had no org-agenda-skip-function. The global org-agenda-skip-scheduled-if-done is nil. CANCELLED tasks with a SCHEDULED date rendered in the forward-looking schedule unfiltered. The fix adds an org-agenda-skip-function to the SCHEDULE block: (org-agenda-skip-entry-if 'todo '("CANCELLED")). The scope is deliberate. Only CANCELLED is filtered, not DONE or FAILED. A scheduled DONE task is a record of when something happened and stays visible. Tests cover the configuration: the form must appear on the agenda block and must not appear on the overdue, hi-pri, or priority-B blocks.
Diffstat (limited to 'tests/test-org-agenda-config-skip-functions.el')
-rw-r--r--tests/test-org-agenda-config-skip-functions.el35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test-org-agenda-config-skip-functions.el b/tests/test-org-agenda-config-skip-functions.el
index 24eeb7e4..17ee848f 100644
--- a/tests/test-org-agenda-config-skip-functions.el
+++ b/tests/test-org-agenda-config-skip-functions.el
@@ -7,6 +7,9 @@
;; - cj/org-skip-subtree-if-keyword
;; - cj/org-agenda-skip-subtree-if-not-overdue
;;
+;; Also covers the "d" command's SCHEDULE block config -- the skip-function
+;; that filters CANCELLED entries from the forward-looking agenda.
+;;
;; Uses dynamic timestamp generation (no hardcoded dates) via testutil-org.
;;; Code:
@@ -212,5 +215,37 @@ Suppresses org-mode hooks to avoid loading packages not available in batch."
"DEADLINE: " (test-org-timestamp-days-ahead 14) "\n")
(should (integerp (cj/org-agenda-skip-subtree-if-not-overdue)))))
+;;; ---------- "d" command SCHEDULE block: CANCELLED skip ----------
+
+;;; Normal Cases
+
+(ert-deftest test-org-agenda-config-schedule-block-skips-cancelled ()
+ "Normal: main-agenda \"d\" SCHEDULE block has a skip-function for CANCELLED.
+This is the configuration check that locks in the fix for the
+CANCELLED-in-schedule bug: without the skip-function form on the
+(agenda ...) block, cancelled tasks render in the schedule view."
+ (let* ((entry (assoc "d" org-agenda-custom-commands))
+ (blocks (nth 2 entry))
+ (agenda-block (seq-find (lambda (b) (eq (car b) 'agenda)) blocks))
+ (opts (nth 2 agenda-block))
+ (skip-form (cadr (assoc 'org-agenda-skip-function opts))))
+ (should (equal skip-form
+ '(quote (org-agenda-skip-entry-if 'todo '("CANCELLED")))))))
+
+;;; Boundary Cases
+
+(ert-deftest test-org-agenda-config-schedule-cancelled-skip-scoped-to-agenda-block ()
+ "Boundary: only the (agenda ...) block carries the CANCELLED skip.
+The fix is deliberately scoped to the SCHEDULE block; the overdue/hi-pri/
+priority-B blocks must not pick up the same skip-function form."
+ (let* ((entry (assoc "d" org-agenda-custom-commands))
+ (blocks (nth 2 entry))
+ (non-agenda (seq-remove (lambda (b) (eq (car b) 'agenda)) blocks))
+ (cancelled-form '(quote (org-agenda-skip-entry-if 'todo '("CANCELLED")))))
+ (dolist (b non-agenda)
+ (let* ((opts (nth 2 b))
+ (skip (cadr (assoc 'org-agenda-skip-function opts))))
+ (should-not (equal skip cancelled-form))))))
+
(provide 'test-org-agenda-config-skip-functions)
;;; test-org-agenda-config-skip-functions.el ends here