From cf5ab2cbc202f04af6a07cfd1b90ae06aae4103c Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 10 Oct 2021 16:43:48 -0400 Subject: [PATCH] ADD function to group meeting headlines with their unresolved agenda item headlines --- local/lib/org-x/org-x.el | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/local/lib/org-x/org-x.el b/local/lib/org-x/org-x.el index 6246727..97b32b0 100644 --- a/local/lib/org-x/org-x.el +++ b/local/lib/org-x/org-x.el @@ -1262,13 +1262,13 @@ ARG and INTERACTIVE are passed to `org-store-link'." (defun org-x--make-agenda-metaitem (headline is-closed ts item) (list :meeting-closed-p is-closed :meeting-timestamp ts - :meeting-node headline + :meeting-node (org-ml-remove-parents headline) :item-desc (org-ml-item-get-paragraph item) :item-closed (eq 'on (org-ml-get-property :checkbox item)))) (defun org-x--meeting-get-agenda-items (headline) "Return agenda items for HEADLINE." - (-let ((first (->> (org-ml-headline-get-contents (org-x-log-delete) headline) + (-let ((first (->> (org-ml-headline-get-contents (org-x-logbook-config) headline) (--find (org-x--is-drawer-with-name org-x-drwr-agenda it)) (org-ml-get-children) (car))) @@ -1312,6 +1312,23 @@ ARG and INTERACTIVE are passed to `org-store-link'." (-map #'org-x--metaitems-are-unresolved) (-non-nil))) +(defun org-x--id-parse-headline (id) + "Return the headline node for ID." + (save-excursion + (-let (((file . offset) (org-id-find id))) + (with-current-buffer (find-file-noselect file) + (goto-char offset) + (org-ml-parse-this-headline))))) + +(defun org-x--group-unresolved-links (ls) + "Return links and headlines plist LS grouped by headline offset." + (->> (--group-by (plist-get it :item-headline) ls) + (--map + (-let (((key . rest) it)) + (->> rest + (--map (org-x--id-parse-headline (plist-get it :item-target))) + (cons key)))))) + ;; timestamp shifting (defun org-x--read-number-from-minibuffer (prompt &optional return-str)