branch: elpa/magit commit 033aa10b9357fae94059268d52990e654d624e8b Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Use ## and mapcar instead of --map In three cases use lambda, not ##. --- lisp/magit-apply.el | 17 ++++++++-------- lisp/magit-base.el | 2 +- lisp/magit-bookmark.el | 4 ++-- lisp/magit-branch.el | 10 +++++----- lisp/magit-git.el | 52 +++++++++++++++++++++++++------------------------ lisp/magit-log.el | 6 +++--- lisp/magit-push.el | 4 ++-- lisp/magit-repos.el | 30 +++++++++++++++------------- lisp/magit-section.el | 12 ++++++------ lisp/magit-sequence.el | 12 ++++++------ lisp/magit-submodule.el | 14 ++++++------- lisp/magit-tag.el | 2 +- lisp/magit-worktree.el | 2 +- 13 files changed, 86 insertions(+), 81 deletions(-) diff --git a/lisp/magit-apply.el b/lisp/magit-apply.el index cbbe2c1b6f1..17d055c78f4 100644 --- a/lisp/magit-apply.el +++ b/lisp/magit-apply.el @@ -217,7 +217,7 @@ adjusted as \"@@ -10,6 +10,7 @@\" and \"@@ -18,6 +19,7 @@\"." (defun magit-apply-patch (section:s args patch) (let* ((files (if (atom section:s) (list (oref section:s value)) - (--map (oref it value) section:s))) + (mapcar (##oref % value) section:s))) (command (symbol-name this-command)) (command (if (and command (string-match "^magit-\\([^-]+\\)" command)) (match-string 1 command) @@ -251,11 +251,12 @@ adjusted as \"@@ -10,6 +10,7 @@\" and \"@@ -18,6 +19,7 @@\"." (defun magit-apply--get-diffs (sections) (magit-section-case ([file diffstat] - (--map (or (magit-get-section - (append `((file . ,(oref it value))) - (magit-section-ident magit-root-section))) - (error "Cannot get required diff headers")) - sections)) + (mapcar (lambda (section) + (or (magit-get-section + (append `((file . ,(oref section value))) + (magit-section-ident magit-root-section))) + (error "Cannot get required diff headers"))) + sections)) (t sections))) (defun magit-apply--ignore-whitespace-p (selection type scope) @@ -683,7 +684,7 @@ of a side, then keep that side without prompting." (magit-call-git "reset" "--" orig))))) (defun magit-discard-files--discard (sections new-files) - (let ((files (--map (oref it value) sections))) + (let ((files (mapcar (##oref % value) sections))) (magit-confirm-files 'discard (append files new-files) (format "Discard %s changes in" (magit-diff-type))) (if (eq (magit-diff-type (car sections)) 'unstaged) @@ -758,7 +759,7 @@ so causes the change to be applied to the index as well." "--cached"))))) (--separate (member (oref it value) bs) sections)))) - (magit-confirm-files 'reverse (--map (oref it value) sections)) + (magit-confirm-files 'reverse (mapcar (##oref % value) sections)) (cond ((length= sections 1) (magit-reverse-apply (car sections) #'magit-apply-diff args)) (sections diff --git a/lisp/magit-base.el b/lisp/magit-base.el index 1834c9b0d87..b58f3dc7d77 100644 --- a/lisp/magit-base.el +++ b/lisp/magit-base.el @@ -781,7 +781,7 @@ This is similar to `read-string', but (string-join (butlast parts) ", ") ", or " (car (last parts)) " ")) ',(mapcar #'car clauses)) - ,@(--map `(,(car it) ,@(cddr it)) clauses)) + ,@(mapcar (##`(,(car %) ,@(cddr %))) clauses)) (message ""))) (defun magit-y-or-n-p (prompt &optional action) diff --git a/lisp/magit-bookmark.el b/lisp/magit-bookmark.el index 061ef293328..963b7e1caf8 100644 --- a/lisp/magit-bookmark.el +++ b/lisp/magit-bookmark.el @@ -44,8 +44,8 @@ (magit-display-buffer-noselect t)) (apply (intern (format "%s-setup-buffer" (substring (symbol-name mode) 0 -5))) - (--map (bookmark-prop-get bookmark it) - (get mode 'magit-bookmark-variables))))) + (mapcar (##bookmark-prop-get bookmark %) + (get mode 'magit-bookmark-variables))))) ;;; Diff ;;;; Diff diff --git a/lisp/magit-branch.el b/lisp/magit-branch.el index 0c5e63a4cc9..11ba296fff0 100644 --- a/lisp/magit-branch.el +++ b/lisp/magit-branch.el @@ -644,7 +644,7 @@ prompt is confusing." "push" (and (or force magit-branch-delete-never-verify) "--no-verify") remote - (--map (concat ":" (substring it offset)) branches)) + (mapcar (##concat ":" (substring % offset)) branches)) ;; If that is not the case, then this deletes the tracking branches. (set-process-sentinel magit-this-process @@ -731,8 +731,8 @@ prompt is confusing." (defun magit-delete-remote-branch-sentinel (remote refs process event) (when (memq (process-status process) '(exit signal)) (if (= (process-exit-status process) 1) - (if-let ((on-remote (--map (concat "refs/remotes/" remote "/" it) - (magit-remote-list-branches remote))) + (if-let ((on-remote (mapcar (##concat "refs/remotes/" remote "/" %) + (magit-remote-list-branches remote))) (rest (--filter (and (not (member it on-remote)) (magit-ref-exists-p it)) refs))) @@ -831,8 +831,8 @@ and also rename the respective reflog file." (interactive (list (magit-completing-read "Unshelve branch" - (--map (substring it 8) - (magit-list-refnames "refs/shelved")) + (mapcar (##substring % 8) + (magit-list-refnames "refs/shelved")) nil t))) (let ((old (concat "refs/shelved/" branch)) (new (concat "refs/heads/" branch))) diff --git a/lisp/magit-git.el b/lisp/magit-git.el index 041f3fae40d..d97c67d051b 100644 --- a/lisp/magit-git.el +++ b/lisp/magit-git.el @@ -1152,21 +1152,23 @@ or if no rename is detected." (defcustom magit-cygwin-mount-points (and (eq system-type 'windows-nt) - (cl-sort (--map (if (string-match "^\\(.*\\) on \\(.*\\) type" it) - (cons (file-name-as-directory (match-string 2 it)) - (file-name-as-directory (match-string 1 it))) - (lwarn '(magit) :error - "Failed to parse Cygwin mount: %S" it)) - ;; If --exec-path is not a native Windows path, - ;; then we probably have a cygwin git. - (let ((process-environment - (append magit-git-environment - process-environment))) - (and (not (string-match-p - "\\`[a-zA-Z]:" - (car (process-lines - magit-git-executable "--exec-path")))) - (ignore-errors (process-lines "mount"))))) + (cl-sort (mapcar + (lambda (mount) + (if (string-match "^\\(.*\\) on \\(.*\\) type" mount) + (cons (file-name-as-directory (match-string 2 mount)) + (file-name-as-directory (match-string 1 mount))) + (lwarn '(magit) :error + "Failed to parse Cygwin mount: %S" mount))) + ;; If --exec-path is not a native Windows path, + ;; then we probably have a cygwin git. + (let ((process-environment + (append magit-git-environment + process-environment))) + (and (not (string-match-p + "\\`[a-zA-Z]:" + (car (process-lines + magit-git-executable "--exec-path")))) + (ignore-errors (process-lines "mount"))))) #'> :key (pcase-lambda (`(,cyg . ,_win)) (length cyg)))) "Alist of (CYGWIN . WIN32) directory names. Sorted from longest to shortest CYGWIN name." @@ -1923,10 +1925,10 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of (and (not symrefp) value))) (magit-git-lines "for-each-ref" (concat "--format=%(symref)" format) - (--map (concat "--sort=" it) - (pcase (or sortby magit-list-refs-sortby) - ((and val (pred stringp)) (list val)) - ((and val (pred listp)) val))) + (mapcar (##concat "--sort=" %) + (pcase (or sortby magit-list-refs-sortby) + ((and val (pred stringp)) (list val)) + ((and val (pred listp)) val))) (or namespaces magit-list-refs-namespaces)))) (defun magit-list-branches () @@ -1940,8 +1942,8 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of (defun magit-list-related-branches (relation &optional commit &rest args) (--remove (string-match-p "\\(\\`(HEAD\\|HEAD -> \\)" it) - (--map (substring it 2) - (magit-git-lines "branch" args relation commit)))) + (mapcar (##substring % 2) + (magit-git-lines "branch" args relation commit)))) (defun magit-list-containing-branches (&optional commit &rest args) (magit-list-related-branches "--contains" commit args)) @@ -2003,7 +2005,7 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of "for-each-ref" (concat "--format=" format) (or args (list "refs/heads" "refs/remotes" "refs/tags"))))) (if (string-search "\f" format) - (--map (split-string it "\f") lines) + (mapcar (##split-string % "\f") lines) lines))) (defun magit-list-remotes () @@ -2022,7 +2024,7 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of (magit-get-all "notes.displayRef"))) (defun magit-list-notes-refnames () - (--map (substring it 6) (magit-list-refnames "refs/notes"))) + (mapcar (##substring % 6) (magit-list-refnames "refs/notes"))) (defun magit-remote-list-tags (remote) (--keep (and (not (string-suffix-p "^{}" it)) @@ -2622,8 +2624,8 @@ and this option only controls what face is used.") (cl-union (and local-branch (if remote (list local-branch) - (--map (concat it "/" local-branch) - (magit-list-remotes)))) + (mapcar (##concat % "/" local-branch) + (magit-list-remotes)))) (magit-list-remote-branch-names remote t) :test #'equal) nil require-match nil 'magit-revision-history default))) diff --git a/lisp/magit-log.el b/lisp/magit-log.el index 0ab1c40729f..e62a1a19ce2 100644 --- a/lisp/magit-log.el +++ b/lisp/magit-log.el @@ -1633,9 +1633,9 @@ The shortstat style is experimental and rather slow." (if (eq style 'age-abbreviated) 1 ; single character (+ 1 ; gap after digits - (apply #'max (--map (max (length (nth 1 it)) - (length (nth 2 it))) - magit--age-spec))))))))) + (apply #'max (mapcar (##max (length (nth 1 %)) + (length (nth 2 %))) + magit--age-spec))))))))) ;;; Select Mode diff --git a/lisp/magit-push.el b/lisp/magit-push.el index c2ba4871b43..51bd4f3b395 100644 --- a/lisp/magit-push.el +++ b/lisp/magit-push.el @@ -128,8 +128,8 @@ the upstream." (not (or (magit-get-upstream-branch branch) (magit--unnamed-upstream-p remote merge) (magit--valid-upstream-p remote merge)))) - (let* ((branches (cl-union (--map (concat it "/" branch) - (magit-list-remotes)) + (let* ((branches (cl-union (mapcar (##concat % "/" branch) + (magit-list-remotes)) (magit-list-remote-branch-names) :test #'equal)) (upstream (magit-completing-read diff --git a/lisp/magit-repos.el b/lisp/magit-repos.el index bb9e933ca34..b50d58f211d 100644 --- a/lisp/magit-repos.el +++ b/lisp/magit-repos.el @@ -327,9 +327,9 @@ If it contains \"%s\" then the directory is substituted for that." "")) magit-repolist-columns))))) (magit-list-repos-uniquify - (--map (cons (file-name-nondirectory (directory-file-name it)) - it) - (magit-list-repos))))) + (mapcar (##cons (file-name-nondirectory (directory-file-name %)) + %) + (magit-list-repos))))) (message "Listing repositories...") (tabulated-list-init-header) (tabulated-list-print t) @@ -524,22 +524,24 @@ instead." (if (length= value 1) (push (cons key (car value)) result) (setq result - (append result - (magit-list-repos-uniquify - (--map (cons (concat - key "\\" - (file-name-nondirectory - (directory-file-name - (substring it 0 (- (1+ (length key))))))) - it) - value)))))) + (append + result + (magit-list-repos-uniquify + (mapcar (lambda (v) + (cons (concat + key "\\" + (file-name-nondirectory + (directory-file-name + (substring v 0 (- (1+ (length key))))))) + v)) + value)))))) dict) result)) (defun magit-repos-alist () (magit-list-repos-uniquify - (--map (cons (file-name-nondirectory (directory-file-name it)) it) - (magit-list-repos)))) + (mapcar (##cons (file-name-nondirectory (directory-file-name %)) %) + (magit-list-repos)))) ;;; _ (provide 'magit-repos) diff --git a/lisp/magit-section.el b/lisp/magit-section.el index d3e2289d112..de08712347e 100644 --- a/lisp/magit-section.el +++ b/lisp/magit-section.el @@ -1952,8 +1952,8 @@ When `magit-section-preserve-visibility' is nil, do nothing." (setq magit--ellipses-sections (or (magit-region-sections) (list (magit-current-section)))))) - (beg (--map (oref it start) sections)) - (end (--map (oref it end) sections))) + (beg (mapcar (##oref % start) sections)) + (end (mapcar (##oref % end) sections))) (when (region-active-p) ;; This ensures that the region face is removed from ellipses ;; when the region becomes inactive, but fails to ensure that @@ -1971,8 +1971,8 @@ When `magit-section-preserve-visibility' is nil, do nothing." (propertize (car magit-section-visibility-indicator) 'font-lock-face (let ((pos (overlay-start ov))) - (delq nil (nconc (--map (overlay-get it 'font-lock-face) - (overlays-at pos)) + (delq nil (nconc (mapcar (##overlay-get % 'font-lock-face) + (overlays-at pos)) (list (get-char-property pos 'font-lock-face)))))))))))) @@ -2049,8 +2049,8 @@ excluding SECTION itself." Return the values that themselves would be returned by `magit-region-sections' (which see)." - (--map (oref it value) - (magit-region-sections condition multiple))) + (mapcar (##oref % value) + (magit-region-sections condition multiple))) (defun magit-region-sections (&optional condition multiple) "Return a list of the selected sections. diff --git a/lisp/magit-sequence.el b/lisp/magit-sequence.el index da7914eace4..9f0eec8245a 100644 --- a/lisp/magit-sequence.el +++ b/lisp/magit-sequence.el @@ -475,9 +475,9 @@ without prompting." nil default)))) (magit-am-arguments))) (magit-run-git-sequencer "am" args "--" - (--map (magit-convert-filename-for-git - (expand-file-name it)) - files))) + (mapcar (##magit-convert-filename-for-git + (expand-file-name %)) + files))) ;;;###autoload (defun magit-am-apply-maildir (&optional maildir args) @@ -1032,9 +1032,9 @@ status buffer (i.e., the reverse of how they will be applied)." (defun magit-rebase-insert-apply-sequence (onto) (let* ((dir (magit-gitdir)) (rewritten - (--map (car (split-string it)) - (magit-file-lines - (expand-file-name "rebase-apply/rewritten" dir)))) + (mapcar (##car (split-string %)) + (magit-file-lines + (expand-file-name "rebase-apply/rewritten" dir)))) (stop (magit-file-line (expand-file-name "rebase-apply/original-commit" dir)))) (dolist (patch (nreverse (cdr (magit-rebase-patches)))) diff --git a/lisp/magit-submodule.el b/lisp/magit-submodule.el index 66a0937c6bd..ce4c148713e 100644 --- a/lisp/magit-submodule.el +++ b/lisp/magit-submodule.el @@ -258,10 +258,10 @@ it is nil, then PATH also becomes the name." (push (if prefer-short path name) minibuffer-history) (magit-read-string-ns "Submodule name" nil (cons 'minibuffer-history 2) - (or (--keep (pcase-let ((`(,var ,val) (split-string it "="))) - (and (equal val path) - (cadr (split-string var "\\.")))) - (magit-git-lines "config" "--list" "-f" ".gitmodules")) + (or (seq-keep (##pcase-let ((`(,var ,val) (split-string % "="))) + (and (equal val path) + (cadr (split-string var "\\.")))) + (magit-git-lines "config" "--list" "-f" ".gitmodules")) (if prefer-short name path))))) ;;;###autoload (autoload 'magit-submodule-register "magit-submodule" nil t) @@ -416,9 +416,9 @@ to recover from making a mistake here, but don't count on it." (when modules (let ((alist (and trash-gitdirs - (--map (split-string it "\0") - (magit-git-lines "submodule" "foreach" "-q" - "printf \"$sm_path\\0$name\n\""))))) + (mapcar (##split-string % "\0") + (magit-git-lines "submodule" "foreach" "-q" + "printf \"$sm_path\\0$name\n\""))))) (magit-git "submodule" "absorbgitdirs" "--" modules) (magit-git "submodule" "deinit" args "--" modules) (magit-git "rm" args "--" modules) diff --git a/lisp/magit-tag.el b/lisp/magit-tag.el index 4ca8855e356..78c87b277ac 100644 --- a/lisp/magit-tag.el +++ b/lisp/magit-tag.el @@ -114,7 +114,7 @@ defaulting to the tag at point. (when tags (magit-call-git "tag" "-d" tags)) (when remote-tags - (magit-run-git-async "push" remote (--map (concat ":" it) remote-tags)))) + (magit-run-git-async "push" remote (mapcar (##concat ":" %) remote-tags)))) (defvar magit-tag-version-regexp-alist '(("^[-._+ ]?snapshot\\.?$" . -4) diff --git a/lisp/magit-worktree.el b/lisp/magit-worktree.el index 67eeaf741f5..f38cad5213a 100644 --- a/lisp/magit-worktree.el +++ b/lisp/magit-worktree.el @@ -178,7 +178,7 @@ If there is only one worktree, then insert nothing." (bare "(bare)")) config))) worktrees)) - (align (1+ (apply #'max (--map (string-width (car it)) cols))))) + (align (1+ (apply #'max (mapcar (##string-width (car %)) cols))))) (pcase-dolist (`(,head . ,config) cols) (magit--insert-worktree config