From 3bb45afccb9f17758c5604e4d883c769f4fc3545 Mon Sep 17 00:00:00 2001 From: Ahmed Shariff Date: Sat, 9 Apr 2022 19:17:53 -0400 Subject: [PATCH] [Fix #2151] org-roam-preview-default-function doesn't copy next node (#2152) --- CHANGELOG.md | 1 + org-roam-mode.el | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f2b74..9f71df5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Removed ### Fixed - [#2130](https://github.com/org-roam/org-roam/pull/2130) buffer: unlinked-references section now also searches within symlinked directories +- [#2152](https://github.com/org-roam/org-roam/pull/2152) org-roam-preview-default-function: doesn't copy copy content of next heading node when current node's content is empty ### Changed diff --git a/org-roam-mode.el b/org-roam-mode.el index 67b26e6..b7ea30f 100644 --- a/org-roam-mode.el +++ b/org-roam-mode.el @@ -449,10 +449,12 @@ In interactive calls OTHER-WINDOW is set with This function returns the all contents under the current headline, up to the next headline." - (let ((beg (progn (org-roam-end-of-meta-data t) - (point))) - (end (progn (org-next-visible-heading 1) - (point)))) + (let ((beg (save-excursion + (org-roam-end-of-meta-data t) + (point))) + (end (save-excursion + (org-next-visible-heading 1) + (point)))) (string-trim (buffer-substring-no-properties beg end)))) (defun org-roam-preview-get-contents (file pt)