ENH fix goal id insert function

This commit is contained in:
Nathan Dwarshuis 2022-04-08 19:18:11 -04:00
parent 58790033db
commit 0c518e1483
1 changed files with 22 additions and 4 deletions

View File

@ -3552,17 +3552,32 @@ except it ignores inactive timestamps."
(org-ml-update-this-headline* (org-ml-update-this-headline*
(org-x-dag-headline-add-parent-link id it))) (org-x-dag-headline-add-parent-link id it)))
(defun org-x-dag-id->path (id)
(cl-labels
((get-parents
(acc id)
(-if-let (p (org-x-dag-id->buffer-parent id))
(get-parents (cons id acc) p)
(cons id acc))))
(get-parents nil id)))
(defun org-x-dag-read-id (ids cur-ids) (defun org-x-dag-read-id (ids cur-ids)
(cl-flet (cl-flet
((make-cell ((make-cell
(id type) (id type)
(-let ((title (org-x-dag-id->title id)) (-let ((title (->> (org-x-dag-id->path id)
(--map (org-x-dag-id->title it))
(s-join "/")
(s-prepend "/")))
(group (pcase (org-x-dag-id->hl-meta-prop id :group)
(:endpoint "EPG")
(:lifetime "LTG")))
(presentp (not (eq type 'toadd))) (presentp (not (eq type 'toadd)))
(prefix (pcase type (prefix (pcase type
(`present ?*) (`present ?*)
(`noexist ?!) (`noexist ?!)
(`toadd ?\s)))) (`toadd ?\s))))
(list (format "%c %s" prefix title) (list (format "%c %s | %s" prefix group title)
:id id :id id
:title title :title title
:presentp presentp)))) :presentp presentp))))
@ -3607,8 +3622,11 @@ except it ignores inactive timestamps."
(defun org-x-dag-link-goal-to-qtp () (defun org-x-dag-link-goal-to-qtp ()
(interactive) (interactive)
(let ((ids (append (org-x-dag->ltg-ids) (org-x-dag->epg-ids))) (let ((ids (->> (list (org-x-dag->goal-file :endpoint)
(legal (list (org-x-qtp-get-file)))) (org-x-dag->goal-file :lifetime))
(org-x-dag-files->ids)
(-filter #'org-x-dag-id->is-buffer-leaf-p)))
(legal (list (org-x-dag->planning-file :quarterly))))
(org-x-dag-this-headline-choose-id nil legal "quarterly plan file" ids))) (org-x-dag-this-headline-choose-id nil legal "quarterly plan file" ids)))
(defun org-x-dag-link-action-to-goal () (defun org-x-dag-link-action-to-goal ()