From e58f58b656cff9d9dc0e4b9fa59e236f0431e1b4 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 13 May 2026 16:14:50 -0500 Subject: 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. --- tests/test-org-agenda-config-skip-functions.el | 17 +++++++++++++++++ 1 file changed, 17 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 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 -- cgit v1.2.3