aboutsummaryrefslogtreecommitdiff
path: root/tests/test-music-config--completion-table.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-18 16:56:22 -0500
committerCraig Jennings <c@cjennings.net>2026-07-18 16:56:22 -0500
commit11de26eb9ac5d79ac1303ff89dfd995fd18cd0ed (patch)
tree4b5c5b3da9cefe6b570f86fad0106f5d153c6a11 /tests/test-music-config--completion-table.el
parent4e63f665bf153203377f58161aa782a25ffd5e9f (diff)
downloaddotemacs-11de26eb9ac5d79ac1303ff89dfd995fd18cd0ed.tar.gz
dotemacs-11de26eb9ac5d79ac1303ff89dfd995fd18cd0ed.zip
feat(completion): right-align custom category annotations
marginalia-align has been right for months, but annotations from the custom completion categories (radio stations, music files, and everything built through the system-lib table helpers) never went through marginalia. They rendered unaligned. A registration helper adds a builtin registry entry per category at table construction, which routes the table's own annotation function through marginalia's aligned field. The radio table converts from an affixation function with hand-rolled padding to a plain annotation, since marginalia now owns the alignment. Self-maintaining: any future custom category built through the helpers registers itself.
Diffstat (limited to 'tests/test-music-config--completion-table.el')
-rw-r--r--tests/test-music-config--completion-table.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test-music-config--completion-table.el b/tests/test-music-config--completion-table.el
index 5e33e655..6b3da442 100644
--- a/tests/test-music-config--completion-table.el
+++ b/tests/test-music-config--completion-table.el
@@ -19,6 +19,10 @@
(defvar-keymap cj/custom-keymap
:doc "Stub keymap for testing")
+;; Declare special here too (the module's bare defvar is file-local) so the
+;; registration test's `let' binds dynamically.
+(defvar marginalia-annotator-registry)
+
;; Load production code
(require 'music-config)
@@ -131,5 +135,15 @@
;; Should not crash, returns empty
(should (null result))))
+;;; Marginalia registration
+
+(ert-deftest test-music-config--completion-table-registers-with-marginalia ()
+ "Normal: building the table registers cj-music-file so marginalia
+right-aligns the size/date annotations."
+ (let ((marginalia-annotator-registry '()))
+ (cj/music--completion-table '("a.mp3"))
+ (should (equal (assq 'cj-music-file marginalia-annotator-registry)
+ '(cj-music-file builtin none)))))
+
(provide 'test-music-config--completion-table)
;;; test-music-config--completion-table.el ends here