diff options
author | Nicolas Petton | 2021-02-25 12:38:11 +0100 |
---|---|---|
committer | Nicolas Petton | 2021-02-25 12:38:11 +0100 |
commit | 645c380b27b18362f3ea6871699acd060610434b (patch) | |
tree | 63b47e293a9ec9db7d7ff3a87b7bfb9384a29a01 | |
parent | 857dd4f845298c6c96fd1977c9feb9e314fc83c3 (diff) | |
download | nroam-645c380b27b18362f3ea6871699acd060610434b.tar.gz nroam-645c380b27b18362f3ea6871699acd060610434b.zip |
Refactor nroam--insert-backlink
* nroam.el (nroam--insert-source-content): Inline into `nroam--insert-backlink'.
-rw-r--r-- | nroam.el | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -226,10 +226,6 @@ Make the region inserted by BODY read-only, and marked with (nroam--do-separated-by-newlines #'nroam--insert-backlink backlinks))) (defun nroam--insert-backlink (backlink) - "Insert a link to the org-roam BACKLINK." - (nroam--insert-source-content backlink)) - -(defun nroam--insert-source-content (backlink) "Insert the source element where BACKLINK is defined." (seq-let (file _ props) backlink (when-let* ((point (plist-get props :point)) @@ -237,15 +233,14 @@ Make the region inserted by BODY read-only, and marked with (type (car elt)) (content (string-trim (cdr elt))) (beg (point))) - (progn - (pcase type - ('headline (progn - (org-paste-subtree 3 (nroam--fix-links content file)) - (goto-char (point-max)))) - (_ (insert (nroam--fix-links content file)))) - (set-text-properties beg (point) - `(nroam-link t file ,file point ,point)) - (insert "\n"))))) + (pcase type + ('headline (progn + (org-paste-subtree 3 (nroam--fix-links content file)) + (goto-char (point-max)))) + (_ (insert (nroam--fix-links content file)))) + (set-text-properties beg (point) + `(nroam-link t file ,file point ,point)) + (insert "\n")))) (defun nroam--crawl-source (file point) "Return the source element in FILE at POINT." |