diff --git a/CHANGELOG.md b/CHANGELOG.md index 256cda2..970f756 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixed ### Changed - [#2040](https://github.com/org-roam/org-roam/pull/2040) completions: fix completions display-width for Helm users +- [#2025](https://github.com/org-roam/org-roam/pull/2025) chore: removed the dependencies on f.el and s.el ## 2.2.0 ### Added diff --git a/extensions/org-roam-dailies.el b/extensions/org-roam-dailies.el index d32da6d..0c0adf4 100644 --- a/extensions/org-roam-dailies.el +++ b/extensions/org-roam-dailies.el @@ -8,7 +8,7 @@ ;; URL: https://github.com/org-roam/org-roam ;; Keywords: org-mode, roam, convenience ;; Version: 2.2.0 -;; Package-Requires: ((emacs "26.1") (dash "2.13") (f "0.17.2") (org-roam "2.1")) +;; Package-Requires: ((emacs "26.1") (dash "2.13") (org-roam "2.1")) ;; This file is NOT part of GNU Emacs. @@ -269,7 +269,7 @@ If FILE is not specified, use the current buffer's file-path." (save-match-data (and (org-roam-file-p path) - (f-descendant-of-p path directory))))) + (org-roam-descendant-of-p path directory))))) ;;;###autoload (defun org-roam-dailies-find-directory () diff --git a/extensions/org-roam-graph.el b/extensions/org-roam-graph.el index cb82261..0d56dea 100644 --- a/extensions/org-roam-graph.el +++ b/extensions/org-roam-graph.el @@ -266,7 +266,7 @@ Handles both Org-roam nodes, and string nodes (e.g. urls)." (org-roam-quote-string (pcase org-roam-graph-shorten-titles (`truncate (truncate-string-to-width title org-roam-graph-max-title-length nil nil "...")) - (`wrap (s-word-wrap org-roam-graph-max-title-length title)) + (`wrap (org-roam-word-wrap org-roam-graph-max-title-length title)) (_ title))))) (setq node-id (org-roam-node-id node) node-properties `(("label" . ,shortened-title) diff --git a/org-roam-capture.el b/org-roam-capture.el index 89fccd2..17498c6 100644 --- a/org-roam-capture.el +++ b/org-roam-capture.el @@ -6,7 +6,7 @@ ;; URL: https://github.com/org-roam/org-roam ;; Keywords: org-mode, roam, convenience ;; Version: 2.2.0 -;; Package-Requires: ((emacs "26.1") (dash "2.13") (f "0.17.2") (org "9.4") (emacsql "3.0.0") (emacsql-sqlite "1.0.0") (magit-section "3.0.0")) +;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.4") (emacsql "3.0.0") (emacsql-sqlite "1.0.0") (magit-section "3.0.0")) ;; This file is NOT part of GNU Emacs. diff --git a/org-roam-db.el b/org-roam-db.el index e848d63..381206d 100644 --- a/org-roam-db.el +++ b/org-roam-db.el @@ -6,7 +6,7 @@ ;; URL: https://github.com/org-roam/org-roam ;; Keywords: org-mode, roam, convenience ;; Version: 2.2.0 -;; Package-Requires: ((emacs "26.1") (dash "2.13") (f "0.17.2") (org "9.4") (emacsql "3.0.0") (emacsql-sqlite "1.0.0") (magit-section "3.0.0")) +;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.4") (emacsql "3.0.0") (emacsql-sqlite "1.0.0") (magit-section "3.0.0")) ;; This file is NOT part of GNU Emacs. diff --git a/org-roam-migrate.el b/org-roam-migrate.el index 3de2fce..631232d 100644 --- a/org-roam-migrate.el +++ b/org-roam-migrate.el @@ -6,7 +6,7 @@ ;; URL: https://github.com/org-roam/org-roam ;; Keywords: org-mode, roam, convenience ;; Version: 2.2.0 -;; Package-Requires: ((emacs "26.1") (dash "2.13") (f "0.17.2") (org "9.4") (emacsql "3.0.0") (emacsql-sqlite "1.0.0") (magit-section "3.0.0")) +;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.4") (emacsql "3.0.0") (emacsql-sqlite "1.0.0") (magit-section "3.0.0")) ;; This file is NOT part of GNU Emacs. diff --git a/org-roam-mode.el b/org-roam-mode.el index bc6c896..a0da21a 100644 --- a/org-roam-mode.el +++ b/org-roam-mode.el @@ -6,7 +6,7 @@ ;; URL: https://github.com/org-roam/org-roam ;; Keywords: org-mode, roam, convenience ;; Version: 2.2.0 -;; Package-Requires: ((emacs "26.1") (dash "2.13") (f "0.17.2") (org "9.4") (emacsql "3.0.0") (emacsql-sqlite "1.0.0") (magit-section "3.0.0")) +;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.4") (emacsql "3.0.0") (emacsql-sqlite "1.0.0") (magit-section "3.0.0")) ;; This file is NOT part of GNU Emacs. @@ -643,7 +643,7 @@ References from FILE are excluded." col (string-to-number (match-string 3 line)) match (match-string 4 line)) (when (and match - (not (f-equal-p (org-roam-node-file node) f)) + (not (file-equal-p (org-roam-node-file node) f)) (member (downcase match) (mapcar #'downcase titles))) (magit-insert-section section (org-roam-grep-section) (oset section file f) diff --git a/org-roam-utils.el b/org-roam-utils.el index ac1d0a1..f2e4ed9 100644 --- a/org-roam-utils.el +++ b/org-roam-utils.el @@ -52,6 +52,16 @@ (org-roam-replace-string "\\" "\\\\") (org-roam-replace-string "\"" "\\\""))) +(defun org-roam-word-wrap (len s) + "If S is longer than LEN, wrap the words with newlines." + (declare (side-effect-free t)) + (save-match-data + (with-temp-buffer + (insert s) + (let ((fill-column len)) + (fill-region (point-min) (point-max))) + (buffer-substring (point-min) (point-max))))) + (defun org-roam-string-equal (s1 s2) "Return t if S1 and S2 are equal. Like `string-equal', but case-insensitive." @@ -99,6 +109,12 @@ SPEC is a list, as per `dolist'." `(dolist ,spec ,@body))) ;;; File utilities +(defun org-roam-descendant-of-p (a b) + "Return t if A is descendant of B." + (unless (equal (file-truename a) (file-truename b)) + (string-prefix-p (expand-file-name b) + (expand-file-name a)))) + (defmacro org-roam-with-file (file keep-buf-p &rest body) "Execute BODY within FILE. If FILE is nil, execute BODY in the current buffer. diff --git a/org-roam.el b/org-roam.el index 9a5e526..0642868 100644 --- a/org-roam.el +++ b/org-roam.el @@ -6,7 +6,7 @@ ;; URL: https://github.com/org-roam/org-roam ;; Keywords: org-mode, roam, convenience ;; Version: 2.2.0 -;; Package-Requires: ((emacs "26.1") (dash "2.13") (f "0.17.2") (org "9.4") (emacsql "3.0.0") (emacsql-sqlite "1.0.0") (magit-section "3.0.0")) +;; Package-Requires: ((emacs "26.1") (dash "2.13") (org "9.4") (emacsql "3.0.0") (emacsql-sqlite "1.0.0") (magit-section "3.0.0")) ;; This file is NOT part of GNU Emacs. @@ -71,7 +71,6 @@ ;; majority of them can be found at https://github.com/org-roam and MELPA. ;; ;;; Code: -(require 'f) (require 'dash) (require 'rx) @@ -195,7 +194,7 @@ FILE is an Org-roam file if: (member ext org-roam-file-extensions) (not (and org-roam-file-exclude-regexp (string-match-p org-roam-file-exclude-regexp path))) - (f-descendant-of-p path (expand-file-name org-roam-directory)))))) + (org-roam-descendant-of-p path (expand-file-name org-roam-directory)))))) (defun org-roam-list-files () "Return a list of all Org-roam files under `org-roam-directory'. @@ -260,7 +259,8 @@ If no files are found, an empty list is returned." (shell-command-to-string it) (ansi-color-filter-apply it) (split-string it "\n") - (seq-filter #'s-present? it))) + (seq-filter (lambda (s) + (or (null s) (string= "" s))) it))) (defun org-roam--list-files-search-globs (exts) "Given EXTS, return a list of search globs.