mirror of
https://github.com/correl/org-roam-export-backlinks.git
synced 2024-11-25 11:09:54 +00:00
Remove unnecessary seq and s deps
Use built-in functions instead
This commit is contained in:
parent
c9d17e8fbb
commit
bad117b220
2 changed files with 10 additions and 12 deletions
|
@ -9,7 +9,7 @@
|
|||
;; Version: 0.0.1
|
||||
;; Keywords: abbrev bib c calendar comm convenience data docs emulations extensions faces files frames games hardware help hypermedia i18n internal languages lisp local maint mail matching mouse multimedia news outlines processes terminals tex tools unix vc wp
|
||||
;; Homepage: https://github.com/correlr/org-roam-export
|
||||
;; Package-Requires: ((emacs "24.3") org-roam s seq)
|
||||
;; Package-Requires: ((emacs "24.3") org-roam)
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
|
@ -20,15 +20,14 @@
|
|||
;;; Code:
|
||||
|
||||
(require 'org-roam)
|
||||
(require 's)
|
||||
(require 'seq)
|
||||
|
||||
(defun org-roam-export-backlink-title (backlink)
|
||||
"Get exportable title of BACKLINK."
|
||||
(s-join " > "
|
||||
(seq-concatenate 'list
|
||||
(list (org-roam-node-title (org-roam-backlink-source-node backlink)))
|
||||
(plist-get (org-roam-backlink-properties backlink) :outline))))
|
||||
(mapconcat #'identity
|
||||
(append
|
||||
(list (org-roam-node-title (org-roam-backlink-source-node backlink)))
|
||||
(plist-get (org-roam-backlink-properties backlink) :outline))
|
||||
" > "))
|
||||
|
||||
(defun org-roam-export-backlink-link (backlink)
|
||||
"Get Org link to BACKLINK."
|
||||
|
@ -40,8 +39,8 @@
|
|||
(insert-file-contents-literally (org-roam-node-file (org-roam-backlink-source-node backlink)))
|
||||
(goto-char (org-roam-backlink-point backlink))
|
||||
(let ((element (org-element-at-point)))
|
||||
(s-trim (buffer-substring (org-element-property :contents-begin element)
|
||||
(org-element-property :contents-end element))))))
|
||||
(string-trim (buffer-substring (org-element-property :contents-begin element)
|
||||
(org-element-property :contents-end element))))))
|
||||
|
||||
(provide 'org-roam-export)
|
||||
;;; org-roam-export.el ends here
|
||||
|
|
5
tests.el
5
tests.el
|
@ -13,7 +13,6 @@
|
|||
(require 'ert)
|
||||
(require 'org-roam)
|
||||
(require 'org-roam-export)
|
||||
(require 'seq)
|
||||
|
||||
(setq org-roam-directory (expand-file-name "./test-slipbox")
|
||||
org-roam-db-location (expand-file-name "org-roam.db"))
|
||||
|
@ -26,7 +25,7 @@
|
|||
|
||||
(ert-deftest lorem-backlink-titles ()
|
||||
(should (equal '("Ipsum > II")
|
||||
(seq-map #'org-roam-export-backlink-title (org-roam-backlinks-get (org-roam-node-from-id "d12a1ce4-3199-42f4-b39b-b68c03458669") :unique t)))))
|
||||
(mapcar #'org-roam-export-backlink-title (org-roam-backlinks-get (org-roam-node-from-id "d12a1ce4-3199-42f4-b39b-b68c03458669") :unique t)))))
|
||||
|
||||
(ert-deftest lorem-backlink-excerpt ()
|
||||
(should (equal '("Aliquam [[id:d12a1ce4-3199-42f4-b39b-b68c03458669][lorem]] ante, suscipit a lorem molestie, aliquet elementum eros. Proin
|
||||
|
@ -39,7 +38,7 @@ commodo, lacinia odio vitae, blandit metus. Nam et tempus ipsum. Aenean lobortis
|
|||
mauris sit amet lorem accumsan blandit. Fusce eleifend, tellus non tristique
|
||||
auctor, ligula justo varius dolor, id bibendum nulla elit ac dui. Vestibulum
|
||||
sodales enim eget tristique tempor.")
|
||||
(seq-map #'org-roam-export-backlink-excerpt (org-roam-backlinks-get (org-roam-node-from-id "d12a1ce4-3199-42f4-b39b-b68c03458669") :unique t)))))
|
||||
(mapcar #'org-roam-export-backlink-excerpt (org-roam-backlinks-get (org-roam-node-from-id "d12a1ce4-3199-42f4-b39b-b68c03458669") :unique t)))))
|
||||
|
||||
(provide 'tests)
|
||||
;;; tests.el ends here
|
||||
|
|
Loading…
Reference in a new issue