Run org-roam-preview-postprocess-functions over org-roam-review previews

This commit is contained in:
Chris Barrett
2022-08-29 16:24:48 +12:00
parent b07e1cb14d
commit 338eab7a1a

View File

@@ -330,16 +330,21 @@ When called with a `C-u' prefix arg, clear the current filter."
str))
(cl-defun org-roam-review-insert-preview (node &optional (depth 0))
(magit-insert-section preview (org-roam-preview-section)
(magit-insert-section section (org-roam-preview-section)
(let* ((start (org-roam-node-point node))
(file (org-roam-node-file node))
(content (org-roam-fontify-like-in-org-mode (org-roam-preview-get-contents file start))))
(oset preview file file)
(oset preview point start)
(insert (org-roam-review-indent-string (if (string-blank-p (string-trim-left content))
(preview (org-roam-fontify-like-in-org-mode (org-roam-preview-get-contents file start)))
(post-formatters
(append org-roam-preview-postprocess-functions
(list (lambda (content)
(org-roam-review-indent-string (if (string-blank-p (string-trim-left content))
(propertize "(Empty)" 'font-lock-face 'font-lock-comment-face)
content)
depth))
depth)))))
(formatted-preview (seq-reduce (lambda (str fn) (funcall fn str)) post-formatters preview)))
(oset section file file)
(oset section point start)
(insert formatted-preview)
(insert "\n\n"))))
(defun org-roam-review--insert-node (node)