aboutsummaryrefslogtreecommitdiff
path: root/modules/help-config.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
commit4d64437433ed221a08a5258243c01e3a05980db9 (patch)
tree5fe8b4ebe02310d33890545bc020b2c163141d40 /modules/help-config.el
parent2cec4136bcef7d984ecbafe95ad5280d7fa463f0 (diff)
downloaddotemacs-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/help-config.el')
-rw-r--r--modules/help-config.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/help-config.el b/modules/help-config.el
index 4858abcf2..114b264ed 100644
--- a/modules/help-config.el
+++ b/modules/help-config.el
@@ -9,7 +9,7 @@
;; Eager reason: help/info/man configuration and its keybindings; eager only by
;; init order, a deferral candidate.
;; Top-level side effects: two global keys, package configuration via use-package.
-;; Runtime requires: none.
+;; Runtime requires: system-lib.
;; Direct test load: yes.
;;
;; This module enhances Emacs' built-in help system and documentation features.
@@ -25,6 +25,7 @@
;;; Code:
+(require 'system-lib) ;; completion table + file annotator
(setq help-window-select t) ;; Always select the help buffer in a separate window
@@ -90,7 +91,11 @@ Preserves any unsaved changes and checks if the file exists."
info-files))
(chosen-name (completing-read
"Select Info file: "
- (mapcar #'car files-alist)
+ (cj/completion-table-annotated
+ 'cj-info-file
+ (cj/completion-file-annotator
+ (lambda (c) (cdr (assoc c files-alist))))
+ (mapcar #'car files-alist))
nil t))
(chosen-file (cdr (assoc chosen-name files-alist))))
(when chosen-file