reddit / emacs

Org mode for handling incoming calls

MrIceandFire · 2022-12-17 16:17
MitchellMarquez42 · 2022-12-17 18:18
!remindme 1.5d
RemindMeBot · 2022-12-17 18:19
I will be messaging you in 1 day on [**2022-12-19 06:18:27 UTC**](http://www.wolframalpha.com/input/?i=2022-12-19%2006:18:27%20UTC%20To%20Local%20Time) to remind you of [**this link**](https://www.reddit.com/r/emacs/comments/zo9q2a/org_mode_for_handling_incoming_calls/j0m21f5/?context=3) [**CLICK THIS LINK**](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Reminder&message=%5Bhttps%3A%2F%2Fwww.reddit.com%2Fr%2Femacs%2Fcomments%2Fzo9q2a%2Forg_mode_for_handling_incoming_calls%2Fj0m21f5%2F%5D%0A%0ARemindMe%21%202022-12-19%2006%3A18%3A27%20UTC) to send a PM to also be reminded and to reduce spam. ^(Parent commenter can ) [^(delete this message to hide from others.)](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Delete%20Comment&message=Delete%21%20zo9q2a) ***** |[^(Info)](https://www.reddit.com/r/RemindMeBot/comments/e1bko7/remindmebot_info_v21/)|[^(Custom)](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Reminder&message=%5BLink%20or%20message%20inside%20square%20brackets%5D%0A%0ARemindMe%21%20Time%20period%20here)|[^(Your Reminders)](https://www.reddit.com/message/compose/?to=RemindMeBot&subject=List%20Of%20Reminders&message=MyReminders%21)|[^(Feedback)](https://www.reddit.com/message/compose/?to=Watchful1&subject=RemindMeBot%20Feedback)| |-|-|-|-|
AblatedSprocket · 2022-12-19 01:08
I'm not great at elisp and Im sure there are better ways to do this, but here's my take: (defun filter-contact-headlines (heading) (let* ((parent (org-element-property :parent heading)) (parent-heading (org-element-property :raw-value parent))) (when (string= parent-heading "Work") (org-element-property :raw-value heading)))) (add-to-list 'org-capture-templates '("c" "call" entry (file "~/org/calls.org") "* Call Title\n:PoROPERTIES:\nCONTACT: %(completing-read \"Please choose a contact:\" (org-element-map (with-temp-buffer (mapc 'insert-file-contents org-contacts-files) (org-element-parse-buffer 'heading)) 'headline 'filter-contact-headlines))%\n")) Ideally, there would be less elisp in the template, but there was a macro expansion error related to `with-temp-buffer` I couldn't get around. This assumes your contacts files have "Work" as the top-level heading, and contact names as a direct subheading. It should find contacts across multiple files, provided they have the same structure. Creating an org link to a contact using completing-read is also doable.
MrIceandFire · 2022-12-21 11:24
I've edited the post with my "solution" :)