From ab03b358ee75fb05864cae3ec8274292953c7c98 Mon Sep 17 00:00:00 2001 From: Vasilij Schneidermann Date: Wed, 6 Apr 2022 19:44:13 +0200 Subject: Replace dash in favor of seq.el --- nov.el | 120 ++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 60 insertions(+), 60 deletions(-) (limited to 'nov.el') diff --git a/nov.el b/nov.el index 5f38137..5126cb8 100644 --- a/nov.el +++ b/nov.el @@ -5,7 +5,7 @@ ;; Author: Vasilij Schneidermann ;; URL: https://depp.brause.cc/nov.el ;; Version: 0.3.4 -;; Package-Requires: ((dash "2.12.0") (esxml "0.3.6") (emacs "25.1")) +;; Package-Requires: ((esxml "0.3.6") (emacs "25.1")) ;; Keywords: hypermedia, multimedia, epub ;; This file is NOT part of GNU Emacs. @@ -45,9 +45,9 @@ (require 'cl-lib) (require 'dom) -(require 'dash) (require 'esxml-query) (require 'image) +(require 'seq) (require 'shr) (require 'url-parse) (require 'xml) @@ -152,8 +152,8 @@ Each element of the stack is a list (NODEINDEX BUFFERPOS).") (defun nov-directory-files (directory) "Returns a list of files in DIRECTORY except for . and .." - (--remove (string-match-p "/\\.\\(?:\\.\\)?\\'" it) - (directory-files directory t))) + (seq-remove (lambda (file) (string-match-p "/\\.\\(?:\\.\\)?\\'" file)) + (directory-files directory t))) (defun nov-contains-nested-directory-p (directory) "Non-nil if DIRECTORY contains exactly one directory." @@ -171,9 +171,9 @@ Each element of the stack is a list (NODEINDEX BUFFERPOS).") (delete-directory child)) (defun nov--fix-permissions (file-or-directory mode) - (->> (file-modes file-or-directory) - (file-modes-symbolic-to-number mode) - (set-file-modes file-or-directory))) + (let* ((modes (file-modes file-or-directory)) + (fixed-mode (file-modes-symbolic-to-number mode modes))) + (set-file-modes file-or-directory fixed-mode))) (defun nov-fix-permissions (directory) "Iterate recursively through DIRECTORY to fix its files." @@ -309,7 +309,8 @@ Required keys are 'identifier and everything in "Extract an alist of manifest files for CONTENT in DIRECTORY. Each alist item consists of the identifier and full path." (mapcar (lambda (node) - (-let [(&alist 'id id 'href href) (dom-attributes node)] + (let ((id (dom-attr node 'id)) + (href (dom-attr node 'href))) (cons (intern id) (nov-make-path directory (nov-urldecode href))))) (esxml-query-all "package>manifest>item" content))) @@ -339,7 +340,7 @@ Each alist item consists of the identifier and full path." (let ((toc-file (assq nov-toc-id manifest))) (when (not toc-file) (error "EPUB 3