4 Commits

Author SHA1 Message Date
  Nicolas Petton 3eb25846d4
Better headline when no linked reference 1 month ago
  Nicolas Petton f25c89adc8
Merge pull request #2 from Whil-/master 1 month ago
  Gustav Wikström 57e6e0f994 Improve code for narrowing in nroam--insert 1 month ago
  Gustav Wikström a5126d19ac Set visibility of backlinks section 1 month ago
1 changed files with 15 additions and 9 deletions
Split View
  1. +15
    -9
      nroam.el

+ 15
- 9
nroam.el View File

@ -185,12 +185,16 @@ 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)
(save-restriction
(narrow-to-region p (point-max))
(org-set-startup-visibility)))))))
(defun nroam--get-backlinks ()
"Return a list of backlinks for the current buffer."
@ -204,9 +208,11 @@ Make the region inserted by BODY read-only, and marked with
(defun nroam--insert-backlinks-heading (count)
"Insert the heading for the backlinks section with a COUNT."
(insert (format "* %s %s\n"
count
(nroam--pluralize count "linked reference"))))
(insert (if (= count 0)
"* No linked reference"
(format "* %s %s\n"
count
(nroam--pluralize count "linked reference")))))
(defun nroam--insert-backlink-group (group)
"Insert all backlinks in GROUP."


Loading…
Cancel
Save