mirror of
https://github.com/pestctrl/emacs-config.git
synced 2026-02-16 16:24:18 +00:00
Authors caching
This commit is contained in:
parent
31ef9a8af9
commit
8167f2d358
1 changed files with 26 additions and 0 deletions
|
|
@ -543,6 +543,32 @@
|
|||
(transient-append-suffix 'magit-worktree "c"
|
||||
'("C" "[async] branch and worktree" my/magit-worktree-branch))
|
||||
|
||||
(defvar my/magit-authors (make-hash-table :test 'equal))
|
||||
|
||||
(defun my/magit-invalidate-authors ()
|
||||
(interactive)
|
||||
(remhash (magit-gitdir) my/magit-authors))
|
||||
|
||||
(defun my/magit-get-authors ()
|
||||
(or (gethash (magit-gitdir) my/magit-authors)
|
||||
(puthash (magit-gitdir)
|
||||
(mapcar (lambda (line)
|
||||
(save-excursion
|
||||
(and (string-match "\\`[\s\t]+[0-9]+\t" line)
|
||||
(list (substring line (match-end 0))))))
|
||||
(magit-git-lines "shortlog" "-n" "-s" "-e" "HEAD"))
|
||||
my/magit-authors)))
|
||||
|
||||
(defun my/magit-transient-read-person (prompt initial-input history)
|
||||
(magit-completing-read
|
||||
prompt
|
||||
(my/magit-get-authors)
|
||||
nil nil initial-input history))
|
||||
|
||||
(advice-add #'magit-transient-read-person
|
||||
:override
|
||||
#'my/magit-transient-read-person)
|
||||
|
||||
;; This is fixed in 5478d4e of magit/transient (committed )
|
||||
;; (require 'transient-bug)
|
||||
;; (with-eval-after-load 'vertico-multiform
|
||||
|
|
|
|||
Loading…
Reference in a new issue