aboutsummaryrefslogtreecommitdiff
path: root/modules/hugo-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
commitdc457ce89a3e78e78d56d6380ef699c05a744137 (patch)
treee6049a44b70e61a960806b90d74dd039f689b407 /modules/hugo-config.el
parentdef740f809db9ebaf0774e5c8f5d7541f07343b5 (diff)
downloaddotemacs-dc457ce89a3e78e78d56d6380ef699c05a744137.tar.gz
dotemacs-dc457ce89a3e78e78d56d6380ef699c05a744137.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/hugo-config.el')
-rw-r--r--modules/hugo-config.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/hugo-config.el b/modules/hugo-config.el
index 7afa45a7..b26398c6 100644
--- a/modules/hugo-config.el
+++ b/modules/hugo-config.el
@@ -9,7 +9,7 @@
;; Eager reason: none; blog publishing is a command-loaded deferral candidate
;; for Phase 4.
;; Top-level side effects: package configuration via use-package.
-;; Runtime requires: user-constants, host-environment.
+;; Runtime requires: user-constants, host-environment, system-lib.
;; Direct test load: yes.
;;
;; Integrates ox-hugo for publishing Org files to a Hugo website.
@@ -27,6 +27,7 @@
(require 'user-constants)
(require 'host-environment)
+(require 'system-lib) ;; completion table + file annotator
;; --------------------------------- Constants ---------------------------------
@@ -166,7 +167,12 @@ Switches #+hugo_draft between true and false."
(if (null drafts)
(message "No drafts found in %s" cj/hugo-content-org-dir)
(let ((choice (completing-read "Open draft: "
- (mapcar #'car drafts) nil t)))
+ (cj/completion-table-annotated
+ 'cj-hugo-draft
+ (cj/completion-file-annotator
+ (lambda (c) (cdr (assoc c drafts))))
+ (mapcar #'car drafts))
+ nil t)))
(find-file (cdr (assoc choice drafts)))))))
;; ---------------------------- Preview and Publish ----------------------------