branch: elpa/magit commit dfd293b951e65d8a64ad00f32f648bf1fc226f50 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Use dolist instead of mapc except in the simplest cases Having the name of the element and the code (or in these cases name) of the list next to each other, increases readability compared to `mapc'. When we call a function by name, naming the argument becomes less desirable, making `mapc' more appealing. --- lisp/magit-base.el | 11 +++++------ lisp/magit-repos.el | 21 ++++++++++----------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/lisp/magit-base.el b/lisp/magit-base.el index f48f8d93c2..96aba336a9 100644 --- a/lisp/magit-base.el +++ b/lisp/magit-base.el @@ -1202,15 +1202,14 @@ Like `message', except that `message-log-max' is bound to nil." ellipsis))) (user-error "Variable magit-ellipsis is invalid")))) -(defun magit--ext-regexp-quote (str) +(defun magit--ext-regexp-quote (string) "Like `reqexp-quote', but for Extended Regular Expressions." (let ((special (string-to-list "[*.\\?+^$({")) (quoted nil)) - (mapc (lambda (c) - (when (memq c special) - (push ?\\ quoted)) - (push c quoted)) - str) + (dolist (char string) + (when (memq char special) + (push ?\\ quoted)) + (push char quoted)) (concat (nreverse quoted)))) ;;; _ diff --git a/lisp/magit-repos.el b/lisp/magit-repos.el index d1f83e370b..0c15ad86f7 100644 --- a/lisp/magit-repos.el +++ b/lisp/magit-repos.el @@ -242,17 +242,16 @@ If it contains \"%s\" then the directory is substituted for that." (let ((base default-directory) (len (length repos)) (i 0)) - (mapc (lambda (repo) - (let ((default-directory - (file-name-as-directory (expand-file-name repo base)))) - (if msg - (let ((msg (concat (format "(%s/%s) " (cl-incf i) len) - (format msg default-directory)))) - (message msg) - (funcall fn) - (message (concat msg "done"))) - (funcall fn)))) - repos))) + (dolist (repo repos) + (let ((default-directory + (file-name-as-directory (expand-file-name repo base)))) + (if msg + (let ((msg (concat (format "(%s/%s) " (cl-incf i) len) + (format msg default-directory)))) + (message msg) + (funcall fn) + (message (concat msg "done"))) + (funcall fn)))))) ;;;; Mode