(db)fix: FOREIGN KEY error in narrowed buffer (#2215)

When trying to save from a narrowed buffer, only the Roam nodes visible
in the narrowed buffer are written to the database.

This commit ensures that org-roam behaves the same whether the current
buffer is narrowed or not.
This commit is contained in:
psii
2022-06-08 18:21:13 +02:00
committed by GitHub
parent 0cd9b9e6d3
commit fcefc1b1b4

View File

@ -381,12 +381,13 @@ If UPDATE-P is non-nil, first remove the file in the database."
(defun org-roam-db-map-nodes (fns) (defun org-roam-db-map-nodes (fns)
"Run FNS over all nodes in the current buffer." "Run FNS over all nodes in the current buffer."
(org-map-region (org-with-wide-buffer
(lambda () (org-map-region
(when (org-roam-db-node-p) (lambda ()
(dolist (fn fns) (when (org-roam-db-node-p)
(funcall fn)))) (dolist (fn fns)
(point-min) (point-max))) (funcall fn))))
(point-min) (point-max))))
(defun org-roam-db-map-links (fns) (defun org-roam-db-map-links (fns)
"Run FNS over all links in the current buffer." "Run FNS over all links in the current buffer."