emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/git-commit c9fad8b58e 10/15: Use mapcar and delq instead o


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit c9fad8b58e 10/15: Use mapcar and delq instead of -keep
Date: Mon, 31 Jul 2023 10:00:21 -0400 (EDT)

branch: elpa/git-commit
commit c9fad8b58e84b624285ea5ec209bcb89759a5ba4
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    Use mapcar and delq instead of -keep
---
 lisp/magit-git.el       | 31 ++++++++++++++++---------------
 lisp/magit-refs.el      | 14 +++++++-------
 lisp/magit-submodule.el |  9 +++++++--
 3 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index aacdf6ffa5..cfff36543b 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -2357,21 +2357,22 @@ and this option only controls what face is used.")
               (magit-branch-remote  (push name remotes))
               (t                    (push name other)))))
         (setq remotes
-              (-keep
-               (lambda (name)
-                 (if (string-match "\\`\\([^/]*\\)/\\(.*\\)\\'" name)
-                     (let ((r (match-string 1 name))
-                           (b (match-string 2 name)))
-                       (and (not (equal b "HEAD"))
-                            (if (equal (concat "refs/remotes/" name)
-                                       (magit-git-string
-                                        "symbolic-ref"
-                                        (format "refs/remotes/%s/HEAD" r)))
-                                (magit--propertize-face
-                                 name 'magit-branch-remote-head)
-                              name)))
-                   name))
-               remotes))
+              (delq nil
+                    (mapcar
+                     (lambda (name)
+                       (if (string-match "\\`\\([^/]*\\)/\\(.*\\)\\'" name)
+                           (let ((r (match-string 1 name))
+                                 (b (match-string 2 name)))
+                             (and (not (equal b "HEAD"))
+                                  (if (equal (concat "refs/remotes/" name)
+                                             (magit-git-string
+                                              "symbolic-ref"
+                                              (format "refs/remotes/%s/HEAD" 
r)))
+                                      (magit--propertize-face
+                                       name 'magit-branch-remote-head)
+                                    name)))
+                         name))
+                     remotes)))
         (let* ((current (magit-get-current-branch))
                (target  (magit-get-upstream-branch current)))
           (dolist (name branches)
diff --git a/lisp/magit-refs.el b/lisp/magit-refs.el
index 8073b66952..e4b31c826d 100644
--- a/lisp/magit-refs.el
+++ b/lisp/magit-refs.el
@@ -622,17 +622,17 @@ line is inserted at all."
     (magit-make-margin-overlay nil t)))
 
 (defun magit-refs--format-local-branches ()
-  (let ((lines (-keep #'magit-refs--format-local-branch
-                      (magit-git-lines
-                       "for-each-ref"
-                       (concat "--format=\
+  (let ((lines (delq nil (mapcar #'magit-refs--format-local-branch
+                                 (magit-git-lines
+                                  "for-each-ref"
+                                  (concat "--format=\
 %(HEAD)%00%(refname:short)%00%(refname)%00\
 %(upstream:short)%00%(upstream)%00%(upstream:track)%00"
-                               (if magit-refs-show-push-remote "\
+                                          (if magit-refs-show-push-remote "\
 %(push:remotename)%00%(push)%00%(push:track)%00%(subject)"
                                  "%00%00%00%(subject)"))
-                       "refs/heads"
-                       magit-buffer-arguments))))
+                                  "refs/heads"
+                                  magit-buffer-arguments)))))
     (unless (magit-get-current-branch)
       (push (magit-refs--format-local-branch
              (concat "*\0\0\0\0\0\0\0\0" (magit-rev-format "%s")))
diff --git a/lisp/magit-submodule.el b/lisp/magit-submodule.el
index e640528169..13288040fd 100644
--- a/lisp/magit-submodule.el
+++ b/lisp/magit-submodule.el
@@ -658,7 +658,12 @@ These sections can be expanded to show the respective 
commits."
 
 (defun magit-submodule-list-refresh ()
   (setq tabulated-list-entries
-        (-keep (lambda (module)
+        ;; Backport version 2.23 of seq lacks seq-keep.  Once that is
+        ;; available trace this commment to find more instances where
+        ;; it should be used.
+        (delq nil
+              (mapcar
+               (lambda (module)
                  (let ((default-directory
                         (expand-file-name (file-name-as-directory module))))
                    (and (file-exists-p ".git")
@@ -673,7 +678,7 @@ These sections can be expanded to show the respective 
commits."
                                                            ,@props))
                                              ""))
                                        magit-repolist-columns))))))
-               (magit-list-module-paths)))
+               (magit-list-module-paths))))
   (message "Listing submodules...")
   (tabulated-list-init-header)
   (tabulated-list-print t)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]