aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-13 16:14:50 -0500
committerCraig Jennings <c@cjennings.net>2026-05-13 16:14:50 -0500
commite58f58b656cff9d9dc0e4b9fa59e236f0431e1b4 (patch)
tree5a946de2c7da1a19786c8db368d889bc6faf72ea /tests
parente179a1022319ec77d936f1cee21c471ac34f4d53 (diff)
downloaddotemacs-e58f58b656cff9d9dc0e4b9fa59e236f0431e1b4.tar.gz
dotemacs-e58f58b656cff9d9dc0e4b9fa59e236f0431e1b4.zip
refactor(org-agenda): extract main-agenda prefix format into a defvar
`org-agenda-custom-commands` inlined ` %i %-15:c%?-15t% s` four times across the "d" command's overdue / high-priority / schedule / priority-B blocks. New `cj/--main-agenda-prefix-format` defvar holds the literal once; every block now references the symbol so a format tweak lands in one place. Regression test walks the "d" command's blocks and asserts each `org-agenda-prefix-format` cell resolves to the shared symbol -- a block that silently diverges fails the check.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-org-agenda-config-skip-functions.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test-org-agenda-config-skip-functions.el b/tests/test-org-agenda-config-skip-functions.el
index 17ee848f..3c044adb 100644
--- a/tests/test-org-agenda-config-skip-functions.el
+++ b/tests/test-org-agenda-config-skip-functions.el
@@ -247,5 +247,22 @@ priority-B blocks must not pick up the same skip-function form."
(skip (cadr (assoc 'org-agenda-skip-function opts))))
(should-not (equal skip cancelled-form))))))
+;;; ---------- prefix-format extracted into a defvar ----------
+
+;;; Normal Cases
+
+(ert-deftest test-org-agenda-config-prefix-format-extracted-to-defvar ()
+ "Normal: every block of the \"d\" command references the shared prefix
+format symbol rather than inlining the literal string. Catches a
+regression where one block diverges from the others on the format."
+ (let* ((entry (assoc "d" org-agenda-custom-commands))
+ (blocks (nth 2 entry)))
+ (should (boundp 'cj/--main-agenda-prefix-format))
+ (should (stringp cj/--main-agenda-prefix-format))
+ (dolist (b blocks)
+ (let* ((opts (nth 2 b))
+ (fmt-form (cadr (assoc 'org-agenda-prefix-format opts))))
+ (should (eq fmt-form 'cj/--main-agenda-prefix-format))))))
+
(provide 'test-org-agenda-config-skip-functions)
;;; test-org-agenda-config-skip-functions.el ends here