From b9c15a587f18131697119b3d7312f8cbe6b4b0bd Mon Sep 17 00:00:00 2001 From: Chris Barrett Date: Wed, 14 Sep 2022 11:38:20 +1200 Subject: [PATCH] Revert buffers after editing links --- lisp/org-roam-rewrite.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/org-roam-rewrite.el b/lisp/org-roam-rewrite.el index d817cd0..e5dc3d3 100644 --- a/lisp/org-roam-rewrite.el +++ b/lisp/org-roam-rewrite.el @@ -122,7 +122,13 @@ It is called with the new node as the current buffer." (when (looking-at org-link-any-re) (replace-match replacement t t)))) - (write-region (point-min) (point-max) file)))) + (write-region (point-min) (point-max) file))) + + (pcase-dolist (`(,file . ,_) backlinks-by-file) + (when-let* ((buf (find-buffer-visiting file))) + (with-current-buffer buf + (revert-buffer t t))))) + ;; Tell org-roam that files changed behind its back. (org-roam-db-sync))