diff options
| -rw-r--r-- | modules/org-agenda-config.el | 4 | ||||
| -rw-r--r-- | tests/test-org-agenda-config-skip-functions.el | 35 |
2 files changed, 39 insertions, 0 deletions
diff --git a/modules/org-agenda-config.el b/modules/org-agenda-config.el index 3b1e9456..70c7fb6d 100644 --- a/modules/org-agenda-config.el +++ b/modules/org-agenda-config.el @@ -296,6 +296,10 @@ KEYWORDS must be a list of strings." ((org-agenda-start-day "0d") (org-agenda-span 8) (org-agenda-start-on-weekday nil) + ;; CANCELLED entries with a SCHEDULED date shouldn't appear + ;; in the forward-looking schedule -- they're dead weight. + (org-agenda-skip-function + '(org-agenda-skip-entry-if 'todo '("CANCELLED"))) (org-agenda-overriding-header cj/main-agenda-schedule-title) (org-agenda-prefix-format " %i %-15:c%?-15t% s"))) (alltodo "" 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 |
