aboutsummaryrefslogtreecommitdiff
path: root/modules/test-runner.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-29 08:42:10 -0400
committerCraig Jennings <c@cjennings.net>2026-06-29 08:42:10 -0400
commit3498b9c2886b2607505717174091a7d23751e37c (patch)
tree0c436cf3123f5c8eb4dd9c29b58111797e519d75 /modules/test-runner.el
parentfc9e838f7c3ded6788de38c2a62bebb5afd99c79 (diff)
downloaddotemacs-3498b9c2886b2607505717174091a7d23751e37c.tar.gz
dotemacs-3498b9c2886b2607505717174091a7d23751e37c.zip
feat(completion): annotate the file-basename pickers with size and date
Eight completing-read pickers listed bare file basenames, so marginalia had no directory to resolve and couldn't annotate them. Add cj/completion-file-annotator to system-lib — an annotation-function factory that takes a candidate->path resolver and yields a size + modification-date suffix (or "dir" for directories, nil for missing files). Wire each picker through cj/completion-table-annotated with a per-site category and resolver: timer sounds, drill flashcards, Info files, the test-runner focus add/remove, vc clone dirs, hugo drafts, and agenda projects (the project's todo.org mtime). music-config's existing completion table gains the category and annotator inline, keeping its sort metadata. The candidate strings and every return value are unchanged — this only adds completion metadata — so all downstream logic is untouched. The six modules that didn't already pull in system-lib now require it. Tests: cj/completion-file-annotator gets Normal/Boundary/Error coverage (file, directory, nil path, missing file). Full suite green at 5394. Claude-Session: https://claude.ai/code/session_014fyKMTTqLrZpL3rDF3dYc3
Diffstat (limited to 'modules/test-runner.el')
-rw-r--r--modules/test-runner.el17
1 files changed, 14 insertions, 3 deletions
diff --git a/modules/test-runner.el b/modules/test-runner.el
index 48a2b09fe..e05145e4e 100644
--- a/modules/test-runner.el
+++ b/modules/test-runner.el
@@ -8,7 +8,7 @@
;; Load shape: eager.
;; Eager reason: registers the C-; t test runner entry point and state.
;; Top-level side effects: defines and registers cj/test-map.
-;; Runtime requires: ert, cl-lib, keybindings.
+;; Runtime requires: ert, cl-lib, keybindings, system-lib.
;; Direct test load: yes.
;;
;; Project-aware ERT runner with two modes: all tests or a focused file set.
@@ -23,6 +23,7 @@
(require 'ert)
(require 'cl-lib)
(require 'keybindings) ;; provides cj/custom-keymap
+(require 'system-lib) ;; completion table + file annotator
;;; External Variables and Functions
@@ -209,7 +210,11 @@ Returns: \\='success if added successfully,
:test #'string=))
(selected (if unfocused-files
(completing-read "Add test file to focus: "
- unfocused-files
+ (cj/completion-table-annotated
+ 'cj-test-file
+ (cj/completion-file-annotator
+ (lambda (c) (expand-file-name c dir)))
+ unfocused-files)
nil t)
(user-error "All test files are already focused"))))
(pcase (cj/test--do-focus-add selected available-files focused-files)
@@ -278,7 +283,13 @@ Returns: \\='success if removed successfully,
(if (null focused-files)
(user-error "No focused files to remove")
(let ((selected (completing-read "Remove from focus: "
- focused-files
+ (cj/completion-table-annotated
+ 'cj-test-file
+ (cj/completion-file-annotator
+ (lambda (c)
+ (expand-file-name
+ c (cj/test--get-test-directory))))
+ focused-files)
nil t)))
(pcase (cj/test--do-focus-remove selected focused-files)
('success