From 202059c53d69093c169b8a05f670f9b97ad007ad Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 27 Jun 2026 13:02:48 -0400 Subject: feat(completion): annotate the Signal and contact pickers via categories Two pickers have bare-name candidates worth a category: the Signal recipient picker, where a name maps to a phone or UUID, and org-contacts find, where a name maps to an email. I tag each with a custom category and a table annotation-function that shows the looked-up value. marginalia has no annotator for these custom categories, so it leaves the table's annotation in place. The other Tier-2 candidates from the survey (ai-term projects, the mu4e contact list) already carry their info inline, so a category adds nothing and I left them bare. --- modules/org-contacts-config.el | 22 ++++++++++++++++++---- modules/signal-config.el | 8 +++++++- 2 files changed, 25 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/org-contacts-config.el b/modules/org-contacts-config.el index 64abb9fb5..944d75c10 100644 --- a/modules/org-contacts-config.el +++ b/modules/org-contacts-config.el @@ -168,15 +168,29 @@ Added: %U" ;;; ------------------------- Quick Contact Functions --------------------------- +(require 'system-lib) + (defun cj/org-contacts-find () "Find and open a contact." (interactive) (find-file contacts-file) (goto-char (point-min)) - (let ((contact (completing-read "Find contact: " - (org-map-entries - (lambda () (nth 4 (org-heading-components))) - nil (list contacts-file))))) + (let* ((alist (org-map-entries + (lambda () + (cons (nth 4 (org-heading-components)) + (or (org-entry-get nil "EMAIL") + (org-entry-get nil "PHONE")))) + nil (list contacts-file))) + (contact (completing-read + "Find contact: " + (cj/completion-table-annotated + 'contact + (lambda (cand) + (let ((info (cdr (assoc cand alist)))) + (when (and info (> (length info) 0)) + (concat " " (propertize info 'face + 'completions-annotations))))) + alist)))) (goto-char (point-min)) (search-forward contact) (org-fold-show-entry) diff --git a/modules/signal-config.el b/modules/signal-config.el index 86cb523ce..edb7d0dc3 100644 --- a/modules/signal-config.el +++ b/modules/signal-config.el @@ -309,7 +309,13 @@ opens the chosen recipient in `signel-chat'." (candidates (cons note-self cj/signel--contact-cache)) (table (lambda (string pred action) (if (eq action 'metadata) - '(metadata + `(metadata + (category . signal-contact) + (annotation-function + . ,(lambda (cand) + (let ((r (cdr (assoc cand candidates)))) + (when r + (concat " " (propertize r 'face 'completions-annotations)))))) (display-sort-function . identity) (cycle-sort-function . identity)) (complete-with-action action candidates string pred)))) -- cgit v1.2.3