diff options
-rw-r--r-- | nroam.el | 6 | ||||
-rw-r--r-- | readme.org | 2 | ||||
-rw-r--r-- | tests/nroam-test.el | 16 |
3 files changed, 20 insertions, 4 deletions
@@ -140,6 +140,12 @@ Make the region inserted by BODY read-only, and marked with (and (markerp nroam-start-marker) (marker-position nroam-start-marker))) +(defun nroam-goto () + "Move point to the beginning of nroam sections if any." + (interactive) + (when (nroam--sections-inserted-p) + (setf (point) (marker-position nroam-start-marker)))) + (defun nroam--prune () "Remove nroam sections from the current buffer." (let ((inhibit-read-only t)) @@ -1,4 +1,4 @@ -* nroam +* nroam [[https://github.com/NicolasPetton/nroam/actions/workflows/test.yml/badge.svg]] nroam is a supplementary package for [[https://github.com/org-roam/org-roam][org-roam]] that replaces the backlink side buffer of Org-roam. Instead, it displays org-roam diff --git a/tests/nroam-test.el b/tests/nroam-test.el index 63e5b8a..c9a8a05 100644 --- a/tests/nroam-test.el +++ b/tests/nroam-test.el @@ -39,16 +39,26 @@ Execute BODY and cleanup the file and buffer after that." (nroam-test-with-temp-file-buffer (insert "foo")) +(defconst nroam-test-main-section-regexp "^* Backlinks") + (describe "nroam" - (describe "nroam-more" + (describe "nroam-mode" (it "creates nroam sections immediately" (nroam-test-with-temp-file-buffer (insert "#+title: my notes\n") (nroam-mode) (setf (point) (point-min)) - (let ((section-position (re-search-forward "^* Backlinks" nil t))) + (let ((section-position (re-search-forward nroam-test-main-section-regexp nil t))) (expect section-position :not :to-be nil) - (expect section-position :to-be-greater-than 10)))))) + (expect section-position :to-be-greater-than 10))))) + (describe "nroam-goto" + (it "moves point if nroam heading is present" + (nroam-test-with-temp-file-buffer + (insert "nroam is great\n") + (nroam-update) + (setf (point) (point-min)) + (nroam-goto) + (expect (looking-at-p nroam-test-main-section-regexp) :to-be t))))) (provide 'nroam-test) ;;; nroam-test.el ends here |