diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-29 08:42:10 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-29 08:42:10 -0400 |
| commit | 4d64437433ed221a08a5258243c01e3a05980db9 (patch) | |
| tree | 5fe8b4ebe02310d33890545bc020b2c163141d40 /modules/chrono-tools.el | |
| parent | 2cec4136bcef7d984ecbafe95ad5280d7fa463f0 (diff) | |
| download | dotemacs-4d64437433ed221a08a5258243c01e3a05980db9.tar.gz dotemacs-4d64437433ed221a08a5258243c01e3a05980db9.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/chrono-tools.el')
| -rw-r--r-- | modules/chrono-tools.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/chrono-tools.el b/modules/chrono-tools.el index 744781268..57309178d 100644 --- a/modules/chrono-tools.el +++ b/modules/chrono-tools.el @@ -9,7 +9,7 @@ ;; Eager reason: none; calendar/timer commands, a command-loaded deferral ;; candidate. ;; Top-level side effects: package configuration via use-package. -;; Runtime requires: user-constants. +;; Runtime requires: user-constants, system-lib. ;; Direct test load: yes. ;; ;; This module centralizes configuration for Emacs time-related tools: @@ -21,6 +21,7 @@ ;;; Code: (require 'user-constants) +(require 'system-lib) ;; provides cj/completion-table-annotated, cj/completion-file-annotator ;; Declared by the lazily-loaded `tmr' package; quiet the byte-compiler ;; without forcing the package to load. @@ -107,7 +108,12 @@ Present all audio files in the sounds directory and set the chosen file as (if current-file (format " (current: %s)" current-file) "")) - sound-files nil t nil nil current-file))) + (cj/completion-table-annotated + 'cj-sound-file + (cj/completion-file-annotator + (lambda (c) (expand-file-name c sounds-dir))) + sound-files) + nil t nil nil current-file))) (if (or (null selected-file) (string-empty-p selected-file)) (message "No file selected") (message "%s" (cj/tmr--apply-sound-file selected-file))))))))) |
