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

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

[nongnu] elpa/git-commit ceab312 4/4: magit-submodule-list-predicate: Ne


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit ceab312 4/4: magit-submodule-list-predicate: New variable
Date: Mon, 18 Oct 2021 11:57:38 -0400 (EDT)

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

    magit-submodule-list-predicate: New variable
    
    This can be used to implement commands that only list a subset of
    submodules.  Such commands must set the predicate by passing it
    to `magit-submodule-list-setup', using its new PREDICATE argument.
---
 lisp/magit-submodule.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/magit-submodule.el b/lisp/magit-submodule.el
index 20ef379..54edf56 100644
--- a/lisp/magit-submodule.el
+++ b/lisp/magit-submodule.el
@@ -621,13 +621,16 @@ These sections can be expanded to show the respective 
commits."
   (setq imenu-extract-index-name-function
         #'magit-imenu--submodule-extract-index-name-function))
 
-(defun magit-submodule-list-setup (columns)
+(defvar-local magit-submodule-list-predicate nil)
+
+(defun magit-submodule-list-setup (columns &optional predicate)
   (magit-display-buffer
    (or (magit-get-mode-buffer 'magit-submodule-list-mode)
        (magit-with-toplevel
          (magit-generate-new-buffer 'magit-submodule-list-mode))))
   (magit-submodule-list-mode)
   (setq-local magit-repolist-columns columns)
+  (setq-local magit-submodule-list-predicate predicate)
   (magit-submodule-list-refresh))
 
 (defun magit-submodule-list-refresh ()
@@ -647,6 +650,8 @@ These sections can be expanded to show the respective 
commits."
                  (let ((default-directory
                          (expand-file-name (file-name-as-directory module))))
                    (and (file-exists-p ".git")
+                        (or (not magit-submodule-list-predicate)
+                            (funcall magit-submodule-list-predicate module))
                         (list module
                               (vconcat
                                (mapcar (pcase-lambda (`(,title ,width ,fn 
,props))



reply via email to

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