summaryrefslogtreecommitdiffstatshomepage
path: root/nroam.el
diff options
context:
space:
mode:
Diffstat (limited to 'nroam.el')
-rw-r--r--nroam.el27
1 files changed, 15 insertions, 12 deletions
diff --git a/nroam.el b/nroam.el
index 944290d..329111c 100644
--- a/nroam.el
+++ b/nroam.el
@@ -185,18 +185,21 @@ Make the region inserted by BODY read-only, and marked with
(defun nroam--insert ()
"Insert nroam sections in the current buffer."
- (let ((point (point-max)))
- (with-buffer-modified-unmodified
- (save-excursion
- (goto-char point)
- (unless (bobp)
- (nroam--ensure-empty-line))
- (with-nroam-markers
- (nroam--do-separated-by-newlines #'funcall nroam-sections))
- (when (nroam--sections-inserted-p)
- (save-restriction
- (narrow-to-region point (point-max))
- (org-set-startup-visibility)))))))
+ (with-buffer-modified-unmodified
+ (save-excursion
+ (goto-char (point-max))
+ (unless (bobp)
+ (nroam--ensure-empty-line))
+ (with-nroam-markers
+ (nroam--do-separated-by-newlines #'funcall nroam-sections))
+ (nroam--set-sections-visibility))))
+
+(defun nroam--set-sections-visibility ()
+ "Set nroam section visibility according to `org-set-startup-visibility'."
+ (when (nroam--sections-inserted-p)
+ (save-restriction
+ (narrow-to-region nroam-start-marker nroam-end-marker)
+ (org-set-startup-visibility))))
(defun nroam--get-backlinks ()
"Return a list of backlinks for the current buffer."