pkg update and first config fix
org-brain not working, add org-roam
This commit is contained in:
@@ -1,19 +1,16 @@
|
||||
;;; magit-submodule.el --- submodule support for Magit -*- lexical-binding: t -*-
|
||||
;;; magit-submodule.el --- Submodule support for Magit -*- lexical-binding:t -*-
|
||||
|
||||
;; 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.
|
||||
;; Copyright (C) 2008-2022 The Magit Project Contributors
|
||||
|
||||
;; 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
|
||||
;; 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)
|
||||
;; any later version.
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
;;
|
||||
;; Magit is distributed in the hope that it will be useful, but WITHOUT
|
||||
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
@@ -21,7 +18,7 @@
|
||||
;; License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with Magit. If not, see http://www.gnu.org/licenses.
|
||||
;; along with Magit. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Code:
|
||||
|
||||
@@ -66,14 +63,27 @@ is inserted. If it is nil, then all sections listed in
|
||||
|
||||
(defcustom magit-submodule-list-columns
|
||||
'(("Path" 25 magit-modulelist-column-path nil)
|
||||
("Version" 25 magit-repolist-column-version nil)
|
||||
("Version" 25 magit-repolist-column-version
|
||||
((:sort magit-repolist-version<)))
|
||||
("Branch" 20 magit-repolist-column-branch nil)
|
||||
("B<U" 3 magit-repolist-column-unpulled-from-upstream ((:right-align t)))
|
||||
("B>U" 3 magit-repolist-column-unpushed-to-upstream ((:right-align t)))
|
||||
("B<P" 3 magit-repolist-column-unpulled-from-pushremote ((:right-align t)))
|
||||
("B>P" 3 magit-repolist-column-unpushed-to-pushremote ((:right-align t)))
|
||||
("B" 3 magit-repolist-column-branches ((:right-align t)))
|
||||
("S" 3 magit-repolist-column-stashes ((:right-align t))))
|
||||
("B<U" 3 magit-repolist-column-unpulled-from-upstream
|
||||
((:right-align t)
|
||||
(:sort <)))
|
||||
("B>U" 3 magit-repolist-column-unpushed-to-upstream
|
||||
((:right-align t)
|
||||
(:sort <)))
|
||||
("B<P" 3 magit-repolist-column-unpulled-from-pushremote
|
||||
((:right-align t)
|
||||
(:sort <)))
|
||||
("B>P" 3 magit-repolist-column-unpushed-to-pushremote
|
||||
((:right-align t)
|
||||
(:sort <)))
|
||||
("B" 3 magit-repolist-column-branches
|
||||
((:right-align t)
|
||||
(:sort <)))
|
||||
("S" 3 magit-repolist-column-stashes
|
||||
((:right-align t)
|
||||
(:sort <))))
|
||||
"List of columns displayed by `magit-list-submodules'.
|
||||
|
||||
Each element has the form (HEADER WIDTH FORMAT PROPS).
|
||||
@@ -83,7 +93,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', `:pad-right' and
|
||||
`:sort'.
|
||||
|
||||
The `:sort' function has a weird interface described in the
|
||||
docstring of `tabulated-list--get-sort'. Alternatively `<' and
|
||||
`magit-repolist-version<' can be used as those functions are
|
||||
automatically replaced with functions that satisfy the interface.
|
||||
Set `:sort' to nil to inhibit sorting; if unspecifed, then the
|
||||
column is sortable using the default sorter.
|
||||
|
||||
You may wish to display a range of numeric columns using just one
|
||||
character per column and without any padding between columns, in
|
||||
@@ -100,6 +118,7 @@ than 9."
|
||||
(list (choice :tag "Property"
|
||||
(const :right-align)
|
||||
(const :pad-right)
|
||||
(const :sort)
|
||||
(symbol))
|
||||
(sexp :tag "Value"))))))
|
||||
|
||||
@@ -115,6 +134,8 @@ if non-nil, means to invert the resulting sort."
|
||||
(cons (string :tag "Column name")
|
||||
(boolean :tag "Flip order"))))
|
||||
|
||||
(defvar magit-submodule-list-format-path-functions nil)
|
||||
|
||||
(defcustom magit-submodule-remove-trash-gitdirs nil
|
||||
"Whether `magit-submodule-remove' offers to trash module gitdirs.
|
||||
|
||||
@@ -163,7 +184,7 @@ and also setting this variable to t will lead to tears."
|
||||
())
|
||||
|
||||
(cl-defmethod transient-format-description ((obj magit--git-submodule-suffix))
|
||||
(let ((value (delq nil (mapcar 'transient-infix-value transient--suffixes))))
|
||||
(let ((value (delq nil (mapcar #'transient-infix-value transient--suffixes))))
|
||||
(replace-regexp-in-string
|
||||
"\\[--[^]]+\\]"
|
||||
(lambda (match)
|
||||
@@ -460,12 +481,12 @@ or, failing that, the abbreviated HEAD commit hash."
|
||||
(magit-with-toplevel
|
||||
(let* ((modules (magit-list-module-paths))
|
||||
(path-format (format "%%-%is "
|
||||
(min (apply 'max (mapcar 'length modules))
|
||||
(min (apply #'max (mapcar #'length modules))
|
||||
(/ (window-width) 2))))
|
||||
(branch-format (format "%%-%is " (min 25 (/ (window-width) 3)))))
|
||||
(dolist (module modules)
|
||||
(let ((default-directory
|
||||
(expand-file-name (file-name-as-directory module))))
|
||||
(expand-file-name (file-name-as-directory module))))
|
||||
(magit-insert-section (magit-module-section module t)
|
||||
(insert (propertize (format path-format module)
|
||||
'font-lock-face 'magit-diff-file-heading))
|
||||
@@ -488,19 +509,25 @@ or, failing that, the abbreviated HEAD commit hash."
|
||||
|
||||
(defvar magit-modules-section-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map [remap magit-visit-thing] 'magit-list-submodules)
|
||||
(magit-menu-set map [remap magit-visit-thing]
|
||||
#'magit-list-submodules "List %t")
|
||||
map)
|
||||
"Keymap for `modules' sections.")
|
||||
|
||||
(defvar magit-module-section-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map magit-file-section-map)
|
||||
(define-key map (kbd "C-j") 'magit-submodule-visit)
|
||||
(define-key map [C-return] 'magit-submodule-visit)
|
||||
(define-key map [remap magit-visit-thing] 'magit-submodule-visit)
|
||||
(define-key map [remap magit-delete-thing] 'magit-submodule-unpopulate)
|
||||
(define-key map "K" 'magit-file-untrack)
|
||||
(define-key map "R" 'magit-file-rename)
|
||||
(define-key map (kbd "C-j") #'magit-submodule-visit)
|
||||
(define-key map [C-return] #'magit-submodule-visit)
|
||||
(magit-menu-set map [magit-visit-thing]
|
||||
#'magit-submodule-visit "Visit %s")
|
||||
(magit-menu-set map [magit-stage-file]
|
||||
#'magit-stage "Stage %T"
|
||||
'(:visible (eq (magit-diff-type) 'unstaged)))
|
||||
(magit-menu-set map [magit-unstage-file]
|
||||
#'magit-unstage "Unstage %T"
|
||||
'(:visible (eq (magit-diff-type) 'staged)))
|
||||
(define-key-after map [separator-magit-submodule] menu-bar-separator)
|
||||
(magit-menu-set map [magit-submodule] #'magit-submodule "Module commands...")
|
||||
map)
|
||||
"Keymap for `module' sections.")
|
||||
|
||||
@@ -578,15 +605,16 @@ These sections can be expanded to show the respective commits."
|
||||
(dolist (module modules)
|
||||
(when (magit-module-worktree-p module)
|
||||
(let ((default-directory
|
||||
(expand-file-name (file-name-as-directory module))))
|
||||
(expand-file-name (file-name-as-directory module))))
|
||||
(when (magit-file-accessible-directory-p default-directory)
|
||||
(magit-insert-section sec (magit-module-section module t)
|
||||
(magit-insert-heading
|
||||
(propertize module
|
||||
'font-lock-face 'magit-diff-file-heading)
|
||||
":")
|
||||
(oset sec range range)
|
||||
(magit-git-wash
|
||||
(apply-partially 'magit-log-wash-log 'module)
|
||||
(apply-partially #'magit-log-wash-log 'module)
|
||||
"-c" "push.default=current" "log" "--oneline" range)
|
||||
(when (> (point)
|
||||
(oref sec content))
|
||||
@@ -615,40 +643,29 @@ These sections can be expanded to show the respective commits."
|
||||
:group 'magit-repolist-mode
|
||||
(setq-local x-stretch-cursor nil)
|
||||
(setq tabulated-list-padding 0)
|
||||
(add-hook 'tabulated-list-revert-hook 'magit-submodule-list-refresh nil t)
|
||||
(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))
|
||||
#'magit-repolist--imenu-prev-index-position)
|
||||
(setq imenu-extract-index-name-function #'tabulated-list-get-id))
|
||||
|
||||
(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-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-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))))
|
||||
(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))
|
||||
@@ -669,7 +686,10 @@ These sections can be expanded to show the respective commits."
|
||||
|
||||
(defun magit-modulelist-column-path (spec)
|
||||
"Insert the relative path of the submodule."
|
||||
(cadr (assq :path spec)))
|
||||
(let ((path (cadr (assq :path spec))))
|
||||
(or (run-hook-with-args-until-success
|
||||
'magit-submodule-list-format-path-functions path)
|
||||
path)))
|
||||
|
||||
;;; Utilities
|
||||
|
||||
|
||||
Reference in New Issue
Block a user