diff --git a/core/autoload/buffers.el b/core/autoload/buffers.el index 95439f3a5..05f02a8fb 100644 --- a/core/autoload/buffers.el +++ b/core/autoload/buffers.el @@ -100,7 +100,7 @@ buffers. If there's nothing left, switch to `doom-fallback-buffer'. See (let ((buffers (delq (current-buffer) (doom-real-buffers-list))) (project-dir (doom-project-root))) (cond ((or (not buffers) - (zerop (mod n (1+ (length buffers))))) + (zerop (% n (1+ (length buffers))))) (set-window-buffer nil (doom-fallback-buffer))) ((= (length buffers) 1) (set-window-buffer nil (car buffers))) diff --git a/core/core-keybinds.el b/core/core-keybinds.el index f086914ae..ff1979ed1 100644 --- a/core/core-keybinds.el +++ b/core/core-keybinds.el @@ -194,7 +194,7 @@ Example desc nil))) (t (user-error "Invalid key %s" key)))) - `(progn ,@(reverse forms)))) + `(progn ,@(nreverse forms)))) (provide 'core-keybinds) ;;; core-keybinds.el ends here diff --git a/core/core-lib.el b/core/core-lib.el index 6d7268690..412dbb6f9 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -111,7 +111,7 @@ Examples: ',(if quoted-p h (intern (format "%s-hook" h))) ,fn ,append-p ,local-p) forms))) - `(progn ,@(reverse forms))))) + `(progn ,@(nreverse forms))))) (defmacro remove-hook! (&rest args) "Convenience macro for `remove-hook'. Takes the same arguments as diff --git a/core/core-packages.el b/core/core-packages.el index b4225abe3..dd31dda86 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -170,7 +170,7 @@ files." (funcall load-fn (expand-file-name "init.el" doom-emacs-dir)) (when load-p (mapc (lambda (file) (funcall load-fn file t)) - (append (reverse (file-expand-wildcards (concat doom-core-dir "core*.el"))) + (append (nreverse (file-expand-wildcards (concat doom-core-dir "core*.el"))) (file-expand-wildcards (concat doom-core-dir "autoload/*.el")) (doom--module-paths "config.el"))))) (when (or force-p (not doom-packages)) @@ -227,17 +227,16 @@ is sorted by order of insertion." (let (pairs) (maphash (lambda (key value) (push (cons (car key) (cdr key)) pairs)) doom-modules) - (reverse pairs))) + (nreverse pairs))) (defun doom--module-paths (&optional append-file) "Returns a list of absolute file paths to modules, with APPEND-FILE added, if the file exists." (let (paths) - (dolist (pair (doom--module-pairs)) + (dolist (pair (doom--module-pairs) (nreverse paths)) (let ((path (doom-module-path (car pair) (cdr pair) append-file))) (when (file-exists-p path) - (push path paths)))) - (reverse paths))) + (push path paths)))))) (defun doom--enable-module (module submodule &optional force-p) "Adds MODULE and SUBMODULE to `doom-modules', if it isn't already there (or if @@ -268,8 +267,9 @@ byte-compilation." (setq doom-modules ',doom-modules) (unless noninteractive - ,@(mapcar (lambda (module) `(require! ,(car module) ,(cdr module) t)) - (doom--module-pairs)) + ,@(let (forms) + (dolist (module (doom--module-pairs) (nreverse forms)) + (push `(require! ,(car module) ,(cdr module) t) forms))) (when (display-graphic-p) (require 'server) @@ -349,7 +349,7 @@ them." (pkg-pin (or (plist-get plist :pin) (and old-plist (plist-get old-plist :pin))))) (when pkg-recipe - (when (= 0 (mod (length pkg-recipe) 2)) + (when (= 0 (% (length pkg-recipe) 2)) (plist-put plist :recipe (cons name pkg-recipe))) (when pkg-pin (plist-put plist :pin nil))) @@ -409,7 +409,7 @@ the commandline." (when (file-exists-p generated-autoload-file) (delete-file generated-autoload-file) (message "Deleted old autoloads.el")) - (dolist (file (reverse autoload-files)) + (dolist (file (nreverse autoload-files)) (let ((inhibit-message t)) (update-file-autoloads file)) (message "Scanned %s" (file-relative-name file doom-emacs-dir))) @@ -441,7 +441,7 @@ This may take a while." (n 0) results) (dolist (path (doom--module-paths)) - (nconc targets (reverse (directory-files-recursively path "\\.el$")))) + (nconc targets (nreverse (directory-files-recursively path "\\.el$")))) (dolist (file targets) (push (cons (file-relative-name file doom-emacs-dir) (and (byte-recompile-file file nil 0) @@ -451,7 +451,7 @@ This may take a while." (if targets (message "\n")) (message "Compiled %s files:\n%s" n (mapconcat (lambda (file) (concat "+ " (if (cdr file) "SUCCESS" "FAIL") ": " (car file))) - (reverse results) "\n"))))) + (nreverse results) "\n"))))) ;; diff --git a/modules/feature/evil/config.el b/modules/feature/evil/config.el index 1796ec77a..c64ab2df7 100644 --- a/modules/feature/evil/config.el +++ b/modules/feature/evil/config.el @@ -6,12 +6,12 @@ (def-setting! :evil-state (&rest mode-state-list) "Set the initialize STATE of MODE using `evil-set-initial-state'." (if (cl-every 'listp mode-state-list) - (let (forms) - (dolist (it mode-state-list) - (unless (consp it) - (error ":evil-state expected cons cells, got %s" it)) - (push `(evil-set-initial-state ',(car it) ',(cdr it)) forms)) - `(progn ,@(reverse forms))) + `(progn + ,@(let (forms) + (dolist (it mode-state-list (nreverse forms)) + (unless (consp it) + (error ":evil-state expected cons cells, got %s" it)) + (push `(evil-set-initial-state ',(car it) ',(cdr it)) forms)))) (let ((argc (length mode-state-list))) (unless (= argc 2) (error ":evil-state expected 2 arguments, got %s" argc))) diff --git a/modules/feature/workspaces/autoload/workspaces.el b/modules/feature/workspaces/autoload/workspaces.el index 73c0df68a..cdee52471 100644 --- a/modules/feature/workspaces/autoload/workspaces.el +++ b/modules/feature/workspaces/autoload/workspaces.el @@ -299,7 +299,7 @@ end of the workspace list." (defun +workspace/switch-to-last () "Switch to the last workspace." (interactive) - (+workspace/switch-to (car (reverse (+workspace-list))))) + (+workspace/switch-to (car (last (+workspace-list))))) ;;;###autoload (defun +workspace/cycle (n) diff --git a/modules/ui/doom-modeline/config.el b/modules/ui/doom-modeline/config.el index a61daa059..24bd90d12 100644 --- a/modules/ui/doom-modeline/config.el +++ b/modules/ui/doom-modeline/config.el @@ -216,7 +216,7 @@ project root). Excludes the file basename. See `doom-buffer-name' for that." (max-length (truncate (* (window-body-width) 0.4)))) (when (and buffer-path (not (equal buffer-path "."))) (if (> (length buffer-path) max-length) - (let ((path (reverse (split-string buffer-path "/" t))) + (let ((path (nreverse (split-string buffer-path "/" t))) (output "")) (when (and path (equal "" (car path))) (setq path (cdr path)))