From 9b538aca4c8ca7638d10d7a58d0bc908e65160e0 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 15 Aug 2022 16:43:29 +0530 Subject: Replace seq-do with dolist. * ennum.el (ennum--set-file-modes-recursively, ennum-store-item-union, ennum-publish-index-page, ennum--read-post): Replace seq-do with dolist. --- ennum.el | 77 ++++++++++++++++++++++++++++++---------------------------------- 1 file changed, 36 insertions(+), 41 deletions(-) diff --git a/ennum.el b/ennum.el index a8ab1aa..49caef0 100644 --- a/ennum.el +++ b/ennum.el @@ -90,13 +90,12 @@ the current state of all its variables." (defun ennum--set-file-modes-recursively (directory directory-mode file-mode executable-file-mode) (chmod directory directory-mode) - (seq-do (lambda (file) - (chmod file - (cond - ((file-directory-p file) directory-mode) - ((file-executable-p file) executable-file-mode) - (t file-mode)))) - (ennum-directory-files directory t t))) + (dolist (file (ennum-directory-files directory t t)) + (chmod file + (cond + ((file-directory-p file) directory-mode) + ((file-executable-p file) executable-file-mode) + (t file-mode))))) (defmacro ennum-exp (&rest body) `(ennum-eval (lambda () ,@body))) @@ -126,16 +125,14 @@ the current state of all its variables." (defun ennum-store-item-union (items) "Return a store item that is the union of ITEMS." (ennum-exp - (seq-do (lambda (item) - (seq-do (lambda (destination) - ;; TODO: Print warning about overwriting files? - (let ((source (expand-file-name destination item))) - (unless (file-exists-p destination) - (if (file-directory-p source) - (make-directory destination) - (copy-file source destination t))))) - (reverse (ennum-directory-files item nil t)))) - items))) + (dolist (item items) + (dolist (destination (reverse (ennum-directory-files item nil t))) + ;; TODO: Print warning about overwriting files? + (let ((source (expand-file-name destination item))) + (unless (file-exists-p destination) + (if (file-directory-p source) + (make-directory destination) + (copy-file source destination t)))))))) (defmacro ennum-make-functional-setter (name copier accessor) `(defun ,name (object new-value) @@ -230,10 +227,9 @@ the current state of all its variables." (ennum-with-file-contents filename (let ((metadata (org-export-get-environment 'ennum-html)) (export (apply-partially 'org-export-with-backend 'ennum-html))) - (seq-do (lambda (key) - (unless (plist-member metadata key) - (user-error "Metadata %s not specified" key))) - ennum-mandatory-metadata) + (dolist (key ennum-mandatory-metadata) + (unless (plist-member metadata key) + (user-error "Metadata %s not specified" key))) (let* ((tree (org-element-parse-buffer)) (links (org-element-map tree 'link (lambda (link) @@ -412,26 +408,25 @@ result as a string." (insert (format "#+TITLE: %s\n" title)) (insert (format "#+LANGUAGE: %s\n" tongue)) (insert "#+OPTIONS: num:nil toc:nil\n\n") - (seq-do (lambda (post) - (insert (format "* [[post:%s][%s]]\n" - (ennum-post-slug post) - (ennum-post-title post))) - (insert (format-time-string "/%b %e, %Y/\n\n" (ennum-post-date post))) - (when-let ((thumbnail (ennum-post-thumbnail post))) - (insert (format "[[thumbnail:%s]]\n\n" thumbnail))) - (when-let ((summary (ennum-post-summary post))) - (insert summary) - (insert "\n\n")) - (when-let ((tags (ennum-post-tags post))) - (insert "Tags: ") - (insert - (string-join - (seq-map (lambda (tag) - (format "[[tag:%s][%s]]" (ennum-add-tongue-suffix tag tongue) tag)) - tags) - ", ")) - (insert "\n\n"))) - posts) + (dolist (post posts) + (insert (format "* [[post:%s][%s]]\n" + (ennum-post-slug post) + (ennum-post-title post))) + (insert (format-time-string "/%b %e, %Y/\n\n" (ennum-post-date post))) + (when-let ((thumbnail (ennum-post-thumbnail post))) + (insert (format "[[thumbnail:%s]]\n\n" thumbnail))) + (when-let ((summary (ennum-post-summary post))) + (insert summary) + (insert "\n\n")) + (when-let ((tags (ennum-post-tags post))) + (insert "Tags: ") + (insert + (string-join + (seq-map (lambda (tag) + (format "[[tag:%s][%s]]" (ennum-add-tongue-suffix tag tongue) tag)) + tags) + ", ")) + (insert "\n\n"))) (unless (= page-number 1) (insert (format "[[./%s][Newer posts]]\n\n" (ennum-index-filename (file-name-nondirectory filename-prefix) -- cgit v1.2.3