ADD function to group meeting headlines with their unresolved agenda item headlines

This commit is contained in:
Nathan Dwarshuis 2021-10-10 16:43:48 -04:00
parent 7d8c6cca84
commit cf5ab2cbc2
1 changed files with 19 additions and 2 deletions

View File

@ -1262,13 +1262,13 @@ ARG and INTERACTIVE are passed to `org-store-link'."
(defun org-x--make-agenda-metaitem (headline is-closed ts item) (defun org-x--make-agenda-metaitem (headline is-closed ts item)
(list :meeting-closed-p is-closed (list :meeting-closed-p is-closed
:meeting-timestamp ts :meeting-timestamp ts
:meeting-node headline :meeting-node (org-ml-remove-parents headline)
:item-desc (org-ml-item-get-paragraph item) :item-desc (org-ml-item-get-paragraph item)
:item-closed (eq 'on (org-ml-get-property :checkbox item)))) :item-closed (eq 'on (org-ml-get-property :checkbox item))))
(defun org-x--meeting-get-agenda-items (headline) (defun org-x--meeting-get-agenda-items (headline)
"Return agenda items for 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)) (--find (org-x--is-drawer-with-name org-x-drwr-agenda it))
(org-ml-get-children) (org-ml-get-children)
(car))) (car)))
@ -1312,6 +1312,23 @@ ARG and INTERACTIVE are passed to `org-store-link'."
(-map #'org-x--metaitems-are-unresolved) (-map #'org-x--metaitems-are-unresolved)
(-non-nil))) (-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 ;; timestamp shifting
(defun org-x--read-number-from-minibuffer (prompt &optional return-str) (defun org-x--read-number-from-minibuffer (prompt &optional return-str)