branch: elpa/magit
commit 8010ab4eeda20d3ba9594e22a20da77f2caf82b9
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    Use ## and mapcan instead of --mapcat
    
    In two cases use lambda, not ##.
---
 lisp/magit-diff.el      | 17 +++++++++--------
 lisp/magit-git.el       | 24 ++++++++++++------------
 lisp/magit-gitignore.el | 11 ++++++-----
 lisp/magit-repos.el     |  8 ++++----
 4 files changed, 31 insertions(+), 29 deletions(-)

diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 13ecb8036e4..2e6a40a790c 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -1952,13 +1952,14 @@ commit or stash at point, then prompt for a commit."
   (interactive)
   (when-let ((sections
               (cond ((derived-mode-p 'magit-status-mode)
-                     (--mapcat
-                      (when it
-                        (when (oref it hidden)
-                          (magit-section-show it))
-                        (oref it children))
-                      (list (magit-get-section '((staged)   (status)))
-                            (magit-get-section '((unstaged) (status))))))
+                     (mapcan (lambda (section)
+                               (and section
+                                    (progn
+                                      (when (oref section hidden)
+                                        (magit-section-show section))
+                                      (oref section children))))
+                             (list (magit-get-section '((staged)   (status)))
+                                   (magit-get-section '((unstaged) 
(status))))))
                     ((derived-mode-p 'magit-diff-mode)
                      (seq-filter #'magit-file-section-p
                                  (oref magit-root-section children))))))
@@ -1966,7 +1967,7 @@ commit or stash at point, then prompt for a commit."
         (dolist (s sections)
           (magit-section-show s)
           (magit-section-hide-children s))
-      (let ((children (--mapcat (oref it children) sections)))
+      (let ((children (mapcan (##oref % children) sections)))
         (cond ((and (--any-p (oref it hidden)   children)
                     (--any-p (oref it children) children))
                (mapc #'magit-section-show-headings sections))
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index d97c67d051b..c93df24009b 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -1075,11 +1075,11 @@ tracked file."
                    (magit-headish) "--" files))
 
 (defun magit-binary-files (&rest args)
-  (--mapcat (and (string-match "^-\t-\t\\(.+\\)" it)
-                 (list (match-string 1 it)))
-            (apply #'magit-git-items
-                   "diff" "-z" "--numstat" "--ignore-submodules"
-                   args)))
+  (mapcan (##and (string-match "^-\t-\t\\(.+\\)" %)
+                 (list (match-string 1 %)))
+          (apply #'magit-git-items
+                 "diff" "-z" "--numstat" "--ignore-submodules"
+                 args)))
 
 (defun magit-unmerged-files ()
   (magit-git-items "diff-files" "-z" "--name-only" "--diff-filter=U"))
@@ -1995,9 +1995,9 @@ SORTBY is a key or list of keys to pass to the `--sort' 
flag of
 (defun magit-list-remote-branch-names (&optional remote relative)
   (if (and remote relative)
       (let ((regexp (format "^refs/remotes/%s/\\(.+\\)" remote)))
-        (--mapcat (when (string-match regexp it)
-                    (list (match-string 1 it)))
-                  (magit-list-remote-branches remote)))
+        (mapcan (##when (string-match regexp %)
+                  (list (match-string 1 %)))
+                (magit-list-remote-branches remote)))
     (magit-list-refnames (concat "refs/remotes/" remote))))
 
 (defun magit-format-refs (format &rest args)
@@ -2056,9 +2056,9 @@ SORTBY is a key or list of keys to pass to the `--sort' 
flag of
 
 (defun magit-list-module-paths ()
   (magit-with-toplevel
-    (--mapcat (and (string-match "^160000 [0-9a-z]\\{40,\\} 0\t\\(.+\\)$" it)
-                   (list (match-string 1 it)))
-              (magit-git-items "ls-files" "-z" "--stage"))))
+    (mapcan (##and (string-match "^160000 [0-9a-z]\\{40,\\} 0\t\\(.+\\)$" %)
+                   (list (match-string 1 %)))
+            (magit-git-items "ls-files" "-z" "--stage"))))
 
 (defun magit-list-module-names ()
   (mapcar #'magit-get-submodule-name (magit-list-module-paths)))
@@ -2421,7 +2421,7 @@ and this option only controls what face is used.")
 
 (defun magit-commit-tree (message &optional tree &rest parents)
   (magit-git-string "commit-tree" "--no-gpg-sign" "-m" message
-                    (--mapcat (list "-p" it) (delq nil parents))
+                    (mapcan (##list "-p" %) (delq nil parents))
                     (or tree
                         (magit-git-string "write-tree")
                         (error "Cannot write tree"))))
diff --git a/lisp/magit-gitignore.el b/lisp/magit-gitignore.el
index 14ce4307029..951b0f6cfb1 100644
--- a/lisp/magit-gitignore.el
+++ b/lisp/magit-gitignore.el
@@ -116,11 +116,12 @@ Rules that are defined in that file affect all local 
repositories."
          (base (and base (file-directory-p base) base))
          (choices
           (delete-dups
-           (--mapcat
-            (cons (concat "/" it)
-                  (and-let* ((ext (file-name-extension it)))
-                    (list (concat "/" (file-name-directory it) "*." ext)
-                          (concat "*." ext))))
+           (mapcan
+            (lambda (file)
+              (cons (concat "/" file)
+                    (and-let* ((ext (file-name-extension file)))
+                      (list (concat "/" (file-name-directory file) "*." ext)
+                            (concat "*." ext)))))
             (sort (nconc
                    (magit-untracked-files nil base)
                    ;; The untracked section of the status buffer lists
diff --git a/lisp/magit-repos.el b/lisp/magit-repos.el
index b50d58f211d..510bb1b0927 100644
--- a/lisp/magit-repos.el
+++ b/lisp/magit-repos.el
@@ -510,10 +510,10 @@ instead."
   (cond ((file-readable-p (expand-file-name ".git" directory))
          (list (file-name-as-directory directory)))
         ((and (> depth 0) (file-accessible-directory-p directory))
-         (--mapcat (and (file-directory-p it)
-                        (magit-list-repos-1 it (1- depth)))
-                   (directory-files directory t
-                                    directory-files-no-dot-files-regexp t)))))
+         (mapcan (##and (file-directory-p %)
+                        (magit-list-repos-1 % (1- depth)))
+                 (directory-files directory t
+                                  directory-files-no-dot-files-regexp t)))))
 
 (defun magit-list-repos-uniquify (alist)
   (let (result (dict (make-hash-table :test #'equal)))

Reply via email to