aboutsummaryrefslogtreecommitdiff
path: root/modules/org-contacts-config.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-27 13:02:48 -0400
committerCraig Jennings <c@cjennings.net>2026-06-27 13:02:48 -0400
commit202059c53d69093c169b8a05f670f9b97ad007ad (patch)
tree843967db353033eb9b9bfc46b0d20293b7c0016c /modules/org-contacts-config.el
parentf9d9e003a208c22cd4d390125d990b79a4c0a0e7 (diff)
downloaddotemacs-202059c53d69093c169b8a05f670f9b97ad007ad.tar.gz
dotemacs-202059c53d69093c169b8a05f670f9b97ad007ad.zip
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.
Diffstat (limited to 'modules/org-contacts-config.el')
-rw-r--r--modules/org-contacts-config.el22
1 files changed, 18 insertions, 4 deletions
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)