branch: elpa/git-commit commit efffec2eeb21178eaeabc27df5ac04d750f99c7a Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
magit-repolist-setup-1: New function --- lisp/magit-repos.el | 7 +++++-- lisp/magit-submodule.el | 13 ++----------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/lisp/magit-repos.el b/lisp/magit-repos.el index 684c838d73..8fd9e1569f 100644 --- a/lisp/magit-repos.el +++ b/lisp/magit-repos.el @@ -275,10 +275,11 @@ If it contains \"%s\" then the directory is substituted for that." (with-current-buffer (get-buffer-create "*Magit Repositories*") (magit-repolist-mode) (setq-local magit-repolist-columns columns) + (magit-repolist-setup-1) (magit-repolist-refresh) (switch-to-buffer (current-buffer)))) -(defun magit-repolist-refresh () +(defun magit-repolist-setup-1 () (unless tabulated-list-sort-key (setq tabulated-list-sort-key (pcase-let ((`(,column . ,flip) magit-repolist-sort-key)) @@ -289,7 +290,9 @@ If it contains \"%s\" then the directory is substituted for that." (vconcat (mapcar (pcase-lambda (`(,title ,width ,_fn ,props)) (nconc (list title width t) (-flatten props))) - magit-repolist-columns))) + magit-repolist-columns)))) + +(defun magit-repolist-refresh () (setq tabulated-list-entries (mapcar (pcase-lambda (`(,id . ,path)) (let ((default-directory path)) diff --git a/lisp/magit-submodule.el b/lisp/magit-submodule.el index 6b1ff79628..c43c6beb7d 100644 --- a/lisp/magit-submodule.el +++ b/lisp/magit-submodule.el @@ -630,21 +630,12 @@ These sections can be expanded to show the respective commits." (magit-generate-new-buffer 'magit-submodule-list-mode)))) (magit-submodule-list-mode) (setq-local magit-repolist-columns columns) + (setq-local magit-repolist-sort-key magit-submodule-list-sort-key) (setq-local magit-submodule-list-predicate predicate) + (magit-repolist-setup-1) (magit-submodule-list-refresh)) (defun magit-submodule-list-refresh () - (unless tabulated-list-sort-key - (setq tabulated-list-sort-key - (pcase-let ((`(,column . ,flip) magit-submodule-list-sort-key)) - (cons (or (car (assoc column magit-repolist-columns)) - (caar magit-repolist-columns)) - flip)))) - (setq tabulated-list-format - (vconcat (mapcar (pcase-lambda (`(,title ,width ,_fn ,props)) - (nconc (list title width t) - (-flatten props))) - magit-repolist-columns))) (setq tabulated-list-entries (-keep (lambda (module) (let ((default-directory