From fcefc1b1b4027185dc35cc1fe16c268ae65bc076 Mon Sep 17 00:00:00 2001 From: psii Date: Wed, 8 Jun 2022 18:21:13 +0200 Subject: [PATCH] (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. --- org-roam-db.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/org-roam-db.el b/org-roam-db.el index 1ea7241..930a29a 100644 --- a/org-roam-db.el +++ b/org-roam-db.el @@ -381,12 +381,13 @@ If UPDATE-P is non-nil, first remove the file in the database." (defun org-roam-db-map-nodes (fns) "Run FNS over all nodes in the current buffer." - (org-map-region - (lambda () - (when (org-roam-db-node-p) - (dolist (fn fns) - (funcall fn)))) - (point-min) (point-max))) + (org-with-wide-buffer + (org-map-region + (lambda () + (when (org-roam-db-node-p) + (dolist (fn fns) + (funcall fn)))) + (point-min) (point-max)))) (defun org-roam-db-map-links (fns) "Run FNS over all links in the current buffer."