allow point 0 headings

Check if outline level is 0 at point-min before inserting file-level
info. Fixes #1475
This commit is contained in:
Jethro Kuan
2021-04-17 16:09:59 +08:00
parent f43b24a5bf
commit 597d3c6241

View File

@ -266,6 +266,7 @@ If UPDATE-P is non-nil, first remove the file in the database."
(defun org-roam-db-insert-file-node ()
"Insert the file-level node into the Org-roam cache."
(org-with-point-at 1
(when (= (org-outline-level) 0)
(when-let ((id (org-id-get)))
(let* ((file (buffer-file-name (buffer-base-buffer)))
(title (or (cadr (assoc "TITLE" (org-collect-keywords '("title"))
@ -312,7 +313,7 @@ If UPDATE-P is non-nil, first remove the file in the database."
(org-roam-db-query
[:insert :into refs
:values $v1]
rows))))))))
rows)))))))))
(defun org-roam-db-insert-node-data ()
"Insert node data for headline at point into the Org-roam cache."