(feat): add org-roam-buffer-preview-function (#1388)

Instead of storing preview content in the database, now provide a
function to fetch these on the fly. This paves the way for future
improvements (e.g. showing more lines)
This commit is contained in:
Jethro Kuan
2021-01-17 02:52:39 +08:00
committed by GitHub
parent 06e5814898
commit 1b3a0abd36
2 changed files with 22 additions and 12 deletions

View File

@ -602,17 +602,8 @@ it as FILE-PATH."
(goto-char (org-element-property :begin link))
(let* ((type (org-roam--collate-types (org-element-property :type link)))
(path (org-element-property :path link))
(element (org-element-at-point))
(begin (or (org-element-property :contents-begin element)
(org-element-property :begin element)))
(end (or (org-element-property :contents-end element)
(org-element-property :end element)))
(content (or (org-element-property :raw-value element)
(when (and begin end)
(string-trim (buffer-substring-no-properties begin end)))))
(properties (list :outline (org-roam--get-outline-path)
:content content
:point begin))
:point (point)))
(names (pcase type
("id"
(when-let ((file-path (org-roam-id-get-file path)))