From a5126d19ac80833a1dbde6abae151127431e4e22 Mon Sep 17 00:00:00 2001 From: Gustav Wikström Date: Wed, 24 Feb 2021 17:21:27 +0100 Subject: Set visibility of backlinks section * nroam.el (nroam--insert): Set visibility according to startup-options. --- nroam.el | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'nroam.el') diff --git a/nroam.el b/nroam.el index e7cf780..87855d7 100644 --- a/nroam.el +++ b/nroam.el @@ -185,12 +185,18 @@ Make the region inserted by BODY read-only, and marked with (defun nroam--insert () "Insert nroam sections in the current buffer." - (with-buffer-modified-unmodified - (save-excursion - (goto-char (point-max)) - (with-nroam-markers - (seq-do #'funcall nroam-sections))) - (nroam--hide-drawers))) + (let ((p (point-max))) + (with-buffer-modified-unmodified + (save-excursion + (goto-char p) + (with-nroam-markers + (seq-do #'funcall nroam-sections)) + (when (nroam--sections-inserted-p) + (goto-char (+ p 1)) ; maybe to implicit. But loc. of new + ; backlinks section + (save-restriction + (org-narrow-to-subtree) + (org-set-startup-visibility))))))) (defun nroam--get-backlinks () "Return a list of backlinks for the current buffer." -- cgit v1.2.3-54-g00ecf