ENH inherit links while scanning through buffer

This commit is contained in:
Nathan Dwarshuis 2022-02-21 19:33:26 -05:00
parent 2a182e3e03
commit f58d0bc605
1 changed files with 8 additions and 6 deletions

View File

@ -934,7 +934,8 @@ valid keyword or none of its parents have valid keywords."
this-title (-if-let (s (match-string 3)) (s-trim s) "") this-title (-if-let (s (match-string 3)) (s-trim s) "")
this-tags (-some-> (match-string-no-properties 4) this-tags (-some-> (match-string-no-properties 4)
(split-string ":" t)) (split-string ":" t))
this-key nil) this-key nil
this-links nil)
;; Adjust the stack so that the top headline is the parent of the ;; Adjust the stack so that the top headline is the parent of the
;; current headline ;; current headline
(while (and cur-path (<= this-level (nth 0 (car cur-path)))) (while (and cur-path (<= this-level (nth 0 (car cur-path))))
@ -953,9 +954,11 @@ valid keyword or none of its parents have valid keywords."
(--mapcat (nth 2 it)) (--mapcat (nth 2 it))
(append this-tags org-file-tags)) (append this-tags org-file-tags))
this-tags) this-tags)
;; TODO this could be inherited to make parent linking easier later
this-links (or (org-x-dag-get-parent-links) this-links (or (org-x-dag-get-parent-links)
(when (not this-parent-key) this-file-links)) (if this-parent-key
(-some->> (--first (nth 3 it) cur-path)
(nth 3))
this-file-links))
this-meta (org-x-dag-build-meta file this-meta (org-x-dag-build-meta file
this-point this-point
this-level this-level
@ -964,10 +967,9 @@ valid keyword or none of its parents have valid keywords."
all-tags all-tags
this-parent-key)) this-parent-key))
(!cons (cons this-key this-meta) acc-meta) (!cons (cons this-key this-meta) acc-meta)
(!cons (cons this-key (append (list (nth 1 this-parent)) this-links)) (!cons (cons this-key `(,(nth 1 this-parent) ,@this-links)) acc))
acc))
;; Add current headline to stack ;; Add current headline to stack
(!cons (list this-level this-key this-tags) cur-path)) (!cons (list this-level this-key this-tags this-links) cur-path))
(list (nreverse acc) (nreverse acc-meta)))) (list (nreverse acc) (nreverse acc-meta))))
(defun org-x-dag-get-file-nodes (file) (defun org-x-dag-get-file-nodes (file)