diff options
author | Nicolas Petton | 2021-02-23 21:35:20 +0100 |
---|---|---|
committer | Nicolas Petton | 2021-02-23 21:35:20 +0100 |
commit | 02a791bf971c43dac2f95801a91bfd6a9f3756fc (patch) | |
tree | a7ff772be5980e44aa24f8bf7fcbdadb5f4f6226 /nroam.el | |
parent | fd9001cf4449da2fe7bcafb03d8341b0198e2a51 (diff) | |
download | nroam-02a791bf971c43dac2f95801a91bfd6a9f3756fc.tar.gz nroam-02a791bf971c43dac2f95801a91bfd6a9f3756fc.zip |
Fix org-capture with nroam
Only enable nroam-mode on org-roam file buffers.
Diffstat (limited to 'nroam.el')
-rw-r--r-- | nroam.el | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -29,8 +29,8 @@ ;; buffer of Org-roam. Instead, it displays org-roam backlinks at the end of ;; org-roam buffers. ;; -;; To setup nroam for all org-mode buffer, evaluate the following: -;; (add-hook 'org-mode-hook #'nroam-mode) +;; To setup nroam for all org-roam buffers, evaluate the following: +;; (add-hook 'org-mode-hook #'nroam-setup-maybe) ;;; Code: @@ -71,6 +71,12 @@ Make the region inserted by BODY read-only, and marked with map)) ;;;###autoload +(defun nroam-setup-maybe () + "Setup nroam for the current buffer iff an org-roam buffer." + (when (nroam--org-roam-file-p) + (nroam-mode))) + +;;;###autoload (define-minor-mode nroam-mode "Show nroam sections at the end of org-roam buffers." :lighter "nroam" @@ -120,6 +126,10 @@ Make the region inserted by BODY read-only, and marked with (seq-do #'nroam--insert-backlink-group groups) (nroam--hide-drawers))) +(defun nroam--org-roam-file-p () + "Return non-nil if the current buffer is an org-roam buffer." + (org-roam--org-roam-file-p)) + (defun nroam--init-work-buffer () "Initiate nroam hidden buffer." (get-buffer-create nroam-work-buffer) |