From 26fabb22edfea51e8a686c179ab91d00a2ff0bc3 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 5 May 2026 12:30:42 -0500 Subject: refactor!: collapse three time-left format defcustoms into one alist I merged `chime-time-left-format-at-event', `chime-time-left-format-short', and `chime-time-left-format-long' into a single alist `chime-time-left-formats' keyed by `at-event' / `short' / `long'. Three knobs for one feature (countdown display) was unnecessary surface area; one alist is the same flexibility with a third the namespace. `chime--time-left' switched from a pcase-on-variable to a pcase-on-regime that picks an alist key, then `alist-get's the format string. Behavior is identical for default settings. Test setup in the four affected files now builds the alist with `(list (cons 'KEY VAL) ...)' instead of `'(...)'. The literal-quote form returns the SAME cons-cell structure on every evaluation, so a previous test mutating it via `setf' on `alist-get' poisoned later tests. `list' + `cons' produces fresh structure per call, which is what the tests actually need. Migration: `(setq chime-time-left-format-short "in %mm")' becomes `(setf (alist-get 'short chime-time-left-formats) "in %mm")', or a full `(setq chime-time-left-formats '((at-event . ...) (short . ...) (long . ...)))' replacement. --- tests/test-chime-propertize-modeline.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tests/test-chime-propertize-modeline.el') diff --git a/tests/test-chime-propertize-modeline.el b/tests/test-chime-propertize-modeline.el index 3856831..cc0dbb2 100644 --- a/tests/test-chime-propertize-modeline.el +++ b/tests/test-chime-propertize-modeline.el @@ -38,9 +38,10 @@ (chime-create-test-base-dir) (setq chime-tooltip-header-format "Upcoming Events as of %a %b %d %Y @ %I:%M %p") (setq chime-display-time-format-string "%I:%M %p") - (setq chime-time-left-format-at-event "right now") - (setq chime-time-left-format-short "in %M") - (setq chime-time-left-format-long "in %H %M")) + (setq chime-time-left-formats + (list (cons 'at-event "right now") + (cons 'short "in %M") + (cons 'long "in %H %M")))) (defun test-chime-propertize-teardown () "Teardown function." -- cgit v1.2.3