(node): fix org-roam-node-at-point check (#2195)

org-roam-node-at-point returned the wrong value if point-min is a
level-1 heading node. We make sure that everytime we go up one
heading, the outline-level changes (reduces by 1) to prevent this error.
This commit is contained in:
Jethro Kuan
2022-05-15 16:51:38 -07:00
committed by GitHub
parent 2657f0b444
commit 1f51ec91d5

View File

@ -224,9 +224,13 @@ populated."
(magit-section-up)
(org-roam-node-at-point)))
(t (org-with-wide-buffer
(org-back-to-heading-or-point-min t)
(while (and (not (org-roam-db-node-p))
(not (bobp)))
(while (not (or (org-roam-db-node-p)
(bobp)
;; Handle case where top-level is a heading
(= (funcall outline-level)
(save-excursion
(org-roam-up-heading-or-point-min)
(funcall outline-level)))))
(org-roam-up-heading-or-point-min))
(when-let ((id (org-id-get)))
(org-roam-populate