update packages

This commit is contained in:
2022-01-04 21:35:17 +01:00
parent 1d5275c946
commit 8de00e5202
700 changed files with 42441 additions and 85378 deletions

View File

@@ -1,6 +1,6 @@
;;; magit-submodule.el --- submodule support for Magit -*- lexical-binding: t -*-
;; Copyright (C) 2011-2021 The Magit Project Contributors
;; Copyright (C) 2011-2022 The Magit Project Contributors
;;
;; You should have received a copy of the AUTHORS.md file which
;; lists all contributors. If not, see http://magit.vc/authors.
@@ -8,6 +8,8 @@
;; Author: Jonas Bernoulli <jonas@bernoul.li>
;; Maintainer: Jonas Bernoulli <jonas@bernoul.li>
;; SPDX-License-Identifier: GPL-3.0-or-later
;; Magit is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
@@ -23,12 +25,10 @@
;;; Code:
(eval-when-compile
(require 'subr-x))
(require 'magit)
(defvar x-stretch-cursor)
;;; Options
(defcustom magit-module-sections-hook
@@ -83,9 +83,15 @@ of the column. FORMAT is a function that is called with one
argument, the repository identification (usually its basename),
and with `default-directory' bound to the toplevel of its working
tree. It has to return a string to be inserted or nil. PROPS is
an alist that supports the keys `:right-align' and `:pad-right'."
an alist that supports the keys `:right-align' and `:pad-right'.
You may wish to display a range of numeric columns using just one
character per column and without any padding between columns, in
which case you should use an appropriat HEADER, set WIDTH to 1,
and set `:pad-right' to 0. \"+\" is substituted for numbers higher
than 9."
:package-version '(magit . "2.8.0")
:group 'magit-repolist-mode
:group 'magit-repolist
:type `(repeat (list :tag "Column"
(string :tag "Header Label")
(integer :tag "Column Width")
@@ -97,6 +103,18 @@ an alist that supports the keys `:right-align' and `:pad-right'."
(symbol))
(sexp :tag "Value"))))))
(defcustom magit-submodule-list-sort-key '("Path" . nil)
"Initial sort key for buffer created by `magit-list-submodules'.
If nil, no additional sorting is performed. Otherwise, this
should be a cons cell (NAME . FLIP). NAME is a string matching
one of the column names in `magit-submodule-list-columns'. FLIP,
if non-nil, means to invert the resulting sort."
:package-version '(magit . "3.2.0")
:group 'magit-repolist
:type '(choice (const nil)
(cons (string :tag "Column name")
(boolean :tag "Flip order"))))
(defcustom magit-submodule-remove-trash-gitdirs nil
"Whether `magit-submodule-remove' offers to trash module gitdirs.
@@ -584,13 +602,7 @@ These sections can be expanded to show the respective commits."
(defun magit-list-submodules ()
"Display a list of the current repository's submodules."
(interactive)
(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)
(magit-submodule-list-refresh)
(tabulated-list-print))
(magit-submodule-list-setup magit-submodule-list-columns))
(defvar magit-submodule-list-mode-map
(let ((map (make-sparse-keymap)))
@@ -601,36 +613,63 @@ These sections can be expanded to show the respective commits."
(define-derived-mode magit-submodule-list-mode tabulated-list-mode "Modules"
"Major mode for browsing a list of Git submodules."
:group 'magit-repolist-mode
(setq-local x-stretch-cursor nil)
(setq tabulated-list-padding 0)
(setq tabulated-list-sort-key (cons "Path" nil))
(setq tabulated-list-format
(vconcat (mapcar (pcase-lambda (`(,title ,width ,_fn ,props))
(nconc (list title width t)
(-flatten props)))
magit-submodule-list-columns)))
(tabulated-list-init-header)
(setq-local x-stretch-cursor nil)
(setq tabulated-list-padding 0)
(add-hook 'tabulated-list-revert-hook 'magit-submodule-list-refresh nil t)
(setq imenu-prev-index-position-function
#'magit-imenu--submodule-prev-index-position-function)
(setq imenu-extract-index-name-function
#'magit-imenu--submodule-extract-index-name-function))
(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 ()
(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-submodule-list-columns))
(caar magit-submodule-list-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
(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
(--map (or (funcall (nth 2 it) module) "")
magit-submodule-list-columns))))))
(magit-list-module-paths))))
(mapcar (pcase-lambda (`(,title ,width ,fn ,props))
(or (funcall fn `((:path ,module)
(:title ,title)
(:width ,width)
,@props))
""))
magit-repolist-columns))))))
(magit-list-module-paths)))
(message "Listing submodules...")
(tabulated-list-init-header)
(tabulated-list-print t)
(message "Listing submodules...done"))
(defun magit-modulelist-column-path (path)
(defun magit-modulelist-column-path (spec)
"Insert the relative path of the submodule."
path)
(cadr (assq :path spec)))
;;; Utilities