branch: externals/denote commit 71b221691200e981167ecc277ec1e5f186713684 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Use seq instead of cl-lib We are already 'require'ing seq, so we might as well use it in the few cases where we now call functionality from cl-lib. Thanks to Philip Kaludercic for pointing this out on the emacs-devel mailing list: <https://lists.gnu.org/archive/html/emacs-devel/2022-07/msg00838.html>. --- README.org | 2 +- denote.el | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/README.org b/README.org index d2e1e2907f..2932dd8009 100644 --- a/README.org +++ b/README.org @@ -1970,7 +1970,7 @@ Denote is meant to be a collective effort. Every bit of help matters. + Contributions to code or the manual :: Benjamin Kästner, Damien Cassou, Jack Baty, Jean-Philippe Gagné Guay, Kaushal Modi, Kyle Meyer, - Stefan Monnier. + Philip Kaludercic, Stefan Monnier. + Ideas and/or user feedback :: Abin Simon, Alan Schmitt, Alfredo Borrás, Benjamin Kästner, Colin McLear, Damien Cassou, Frank Ehmsen, diff --git a/denote.el b/denote.el index 00e264b6a8..1d3ef229bd 100644 --- a/denote.el +++ b/denote.el @@ -96,9 +96,7 @@ ;;; Code: (require 'seq) -(eval-when-compile - (require 'cl-lib) - (require 'subr-x)) +(eval-when-compile (require 'subr-x)) (defgroup denote () "Simple notes with an efficient file-naming scheme." @@ -448,11 +446,9 @@ names that are relative to the variable `denote-directory'." (lambda (s) (denote--file-name-relative-to-denote-directory s)) files)))) -(declare-function cl-find-if "cl-seq" (cl-pred cl-list &rest cl-keys)) - (defun denote--get-note-path-by-id (id) "Return the absolute path of ID note in variable `denote-directory'." - (cl-find-if + (seq-find (lambda (f) (string-prefix-p id (file-name-nondirectory f))) (denote--directory-files :absolute))) @@ -864,8 +860,6 @@ where the former does not read dates without a time component." (buffer-file-name buf)) (buffer-list)))))) -(declare-function cl-some "cl-extra" (cl-pred cl-seq &rest cl-rest)) - ;; This should only be relevant for `denote-date', otherwise the ;; identifier is always unique (we trust that no-one writes multiple ;; notes within fractions of a second). @@ -873,9 +867,9 @@ where the former does not read dates without a time component." "Return non-nil if IDENTIFIER already exists." (let ((current-buffer-name (when (buffer-file-name) (file-name-nondirectory (buffer-file-name))))) - (or (cl-some (lambda (file) - (string-match-p (concat "\\`" identifier) file)) - (delete current-buffer-name (denote--buffer-file-names))) + (or (seq-some (lambda (file) + (string-match-p (concat "\\`" identifier) file)) + (delete current-buffer-name (denote--buffer-file-names))) (delete current-buffer-name (denote--directory-files-matching-regexp (concat "\\`" identifier))))))