From 4d64437433ed221a08a5258243c01e3a05980db9 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 29 Jun 2026 08:42:10 -0400 Subject: feat(completion): annotate the file-basename pickers with size and date MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- modules/vc-config.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'modules/vc-config.el') diff --git a/modules/vc-config.el b/modules/vc-config.el index fcca7e07b..60fcaeb89 100644 --- a/modules/vc-config.el +++ b/modules/vc-config.el @@ -8,7 +8,7 @@ ;; Eager reason: the C-x g Magit entry point and the git keymap. ;; Top-level side effects: defines two keymaps, registers under cj/custom-keymap, ;; package configuration via use-package. -;; Runtime requires: user-constants, keybindings. +;; Runtime requires: user-constants, keybindings, system-lib. ;; Direct test load: yes (requires keybindings explicitly). ;; ;; C-x g is my general entry to Magit's version control via the status page. @@ -26,6 +26,7 @@ (require 'user-constants) ;; provides code-dir (require 'keybindings) ;; provides cj/custom-keymap +(require 'system-lib) ;; completion table + file annotator ;; Forward declaration: cj/vc-map is defined later in this file (see ;; `defvar-keymap' below) but referenced earlier in a use-package :bind form. @@ -199,7 +200,13 @@ repository's README if found, else `dired's the clone." (read-directory-name "Clone to: " code-dir)) ;; C-u: Choose from configured list (current-prefix-arg - (completing-read "Clone to: " cj/git-clone-dirs nil t)) + (completing-read "Clone to: " + (cj/completion-table-annotated + 'cj-clone-dir + (cj/completion-file-annotator + (lambda (c) (expand-file-name c))) + cj/git-clone-dirs) + nil t)) ;; No prefix: Use default (first in list) (t (car cj/git-clone-dirs))))) -- cgit v1.2.3