org-roam-mode-sections: Convert to abnormal hook (#1504)

See: #1503
This commit is contained in:
Nicholas Vollmer
2021-05-02 04:35:36 -04:00
committed by GitHub
parent bc4b7fa409
commit 109917c589

View File

@ -124,11 +124,12 @@ and `:slant'."
(defvar org-roam-current-node nil
"The current node at point.")
(defcustom org-roam-mode-sections (list #'org-roam-backlinks-section
#'org-roam-reflinks-section)
"List of functions that insert sections for Org-roam."
(defcustom org-roam-mode-section-functions (list #'org-roam-backlinks-section
#'org-roam-reflinks-section)
"Functions which insert sections of the `org-roam-buffer'.
Each function is called with one argument, which is the current org-roam node at point."
:group 'org-roam
:type '(repeat function))
:type 'hook)
;;; The mode
(defvar org-roam-mode-map
@ -162,8 +163,7 @@ which visits the thing at point."
(org-roam-set-header-line-format (org-roam-node-title org-roam-current-node))
(magit-insert-section (org-roam)
(magit-insert-heading)
(dolist (fn org-roam-mode-sections)
(funcall fn org-roam-current-node))))))
(run-hook-with-args 'org-roam-mode-section-functions org-roam-current-node)))))
(defun org-roam-buffer ()
"Launch an Org-roam buffer for the current node at point."