reddit / emacs

Help annotating consult-org-agenda

JustinSilverman · 2022-06-10 20:58
I would like to modify consult-org-agenda to show the first time-stamp for each heading. I am often searching over meeting notes where I have multiple heading that say "MEETING with person X" and it would be nice if I could easily distinguish them by seeing the timestamp associated with the heading. I have been trying to hack something together (see below), it doesn't produce an error but it also doesn't work. Fundamentally I just don't think I understand the :annotate keyword/function in consult. Any chance someone would be willing to give me a hand with this? ​ (consult-customize consult-org-agenda :annotate (lambda (&optional foo) (let ((end (save-excursion (outline-next-heading) (point)))) (if (or (re-search-forward org-ts-regexp end t) (re-search-forward org-ts-regexp-both end t)) (match-string 0))))) ​ ​
organic-bookworm · 2022-06-11 06:58
I don't know about `consult` APIs, so this is probably not idiomatic, but hacked anyway (consult-customize consult-org-agenda :annotate (lambda (cand) (when-let* ((pom (get-text-property 0 'consult--candidate cand)) (ts (org-entry-get pom "SCHEDULED")) (format " %s" ts))))