update packages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; magit-mode.el --- create and refresh Magit buffers -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2010-2020 The Magit Project Contributors
|
||||
;; Copyright (C) 2010-2021 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.
|
||||
@@ -235,6 +235,8 @@ and Buffer Arguments'."
|
||||
:package-version '(magit . "3.0.0")
|
||||
:group 'magit-buffers
|
||||
:group 'magit-commands
|
||||
:group 'magit-diff
|
||||
:group 'magit-log
|
||||
:type '(choice
|
||||
(const :tag "always use args from buffer" always)
|
||||
(const :tag "use args from buffer if displayed in frame" selected)
|
||||
@@ -266,6 +268,8 @@ and Buffer Arguments'."
|
||||
:package-version '(magit . "3.0.0")
|
||||
:group 'magit-buffers
|
||||
:group 'magit-commands
|
||||
:group 'magit-diff
|
||||
:group 'magit-log
|
||||
:type '(choice
|
||||
(const :tag "always use args from buffer" always)
|
||||
(const :tag "use args from buffer if displayed in frame" selected)
|
||||
@@ -512,10 +516,10 @@ which visits the thing at point using `browse-url'."
|
||||
Magit is documented in info node `(magit)'."
|
||||
:group 'magit
|
||||
(hack-dir-local-variables-non-file-buffer)
|
||||
(face-remap-add-relative 'header-line 'magit-header-line)
|
||||
(setq mode-line-process (magit-repository-local-get 'mode-line-process))
|
||||
(setq-local bookmark-make-record-function 'magit--make-bookmark))
|
||||
|
||||
;;; Highlighting
|
||||
(setq-local bookmark-make-record-function 'magit--make-bookmark)
|
||||
(setq-local isearch-filter-predicate 'magit-section--open-temporarily))
|
||||
|
||||
;;; Local Variables
|
||||
|
||||
@@ -848,13 +852,13 @@ If a frame, then only consider buffers on that frame."
|
||||
(w (window)
|
||||
(b (window-buffer window)))
|
||||
(f (frame)
|
||||
(-some #'w (window-list frame 'no-minibuf))))
|
||||
(seq-some #'w (window-list frame 'no-minibuf))))
|
||||
(pcase-exhaustive frame
|
||||
(`nil (-some #'b (buffer-list)))
|
||||
(`all (-some #'f (frame-list)))
|
||||
(`visible (-some #'f (visible-frame-list)))
|
||||
((or `selected `t) (-some #'w (window-list (selected-frame))))
|
||||
((guard (framep frame)) (-some #'w (window-list frame)))))
|
||||
(`nil (seq-some #'b (buffer-list)))
|
||||
(`all (seq-some #'f (frame-list)))
|
||||
(`visible (seq-some #'f (visible-frame-list)))
|
||||
((or `selected `t) (seq-some #'w (window-list (selected-frame))))
|
||||
((guard (framep frame)) (seq-some #'w (window-list frame)))))
|
||||
(magit--not-inside-repository-error)))
|
||||
|
||||
(defun magit-mode-get-buffer (mode &optional create frame value)
|
||||
@@ -1033,11 +1037,11 @@ Run hooks `magit-pre-refresh-hook' and `magit-post-refresh-hook'."
|
||||
(magit-run-hook-with-benchmark 'magit-post-unstage-hook)))
|
||||
(magit-run-hook-with-benchmark 'magit-post-refresh-hook)
|
||||
(when magit-refresh-verbose
|
||||
(message "Refreshing magit...done (%.3fs, cached %s/%s)"
|
||||
(float-time (time-subtract (current-time) start))
|
||||
(caar magit--refresh-cache)
|
||||
(+ (caar magit--refresh-cache)
|
||||
(cdar magit--refresh-cache)))))
|
||||
(let* ((c (caar magit--refresh-cache))
|
||||
(a (+ c (cdar magit--refresh-cache))))
|
||||
(message "Refreshing magit...done (%.3fs, cached %s/%s (%.0f%%))"
|
||||
(float-time (time-subtract (current-time) start))
|
||||
c a (* (/ c (* a 1.0)) 100)))))
|
||||
(run-hooks 'magit-unwind-refresh-hook))))
|
||||
|
||||
(defun magit-refresh-all ()
|
||||
@@ -1344,15 +1348,15 @@ then the value is not cached, and we return nil."
|
||||
(defun magit-repository-local-exists-p (key &optional repository)
|
||||
"Non-nil when a repository-local value exists for KEY.
|
||||
|
||||
Returns a (KEY . value) cons cell.
|
||||
Return a (KEY . VALUE) cons cell.
|
||||
|
||||
The KEY is matched using `equal'.
|
||||
|
||||
Unless specified, REPOSITORY is the current buffer's repository."
|
||||
(let* ((repokey (or repository (magit-repository-local-repository)))
|
||||
(cache (assoc repokey magit-repository-local-cache)))
|
||||
(and cache
|
||||
(assoc key (cdr cache)))))
|
||||
(when-let ((cache (assoc (or repository
|
||||
(magit-repository-local-repository))
|
||||
magit-repository-local-cache)))
|
||||
(assoc key (cdr cache))))
|
||||
|
||||
(defun magit-repository-local-get (key &optional default repository)
|
||||
"Return the repository-local value for KEY.
|
||||
@@ -1362,21 +1366,30 @@ Return DEFAULT if no value for KEY exists.
|
||||
The KEY is matched using `equal'.
|
||||
|
||||
Unless specified, REPOSITORY is the current buffer's repository."
|
||||
(let ((keyvalue (magit-repository-local-exists-p key repository)))
|
||||
(if keyvalue
|
||||
(cdr keyvalue)
|
||||
default)))
|
||||
(if-let ((keyvalue (magit-repository-local-exists-p key repository)))
|
||||
(cdr keyvalue)
|
||||
default))
|
||||
|
||||
(defun magit-repository-local-delete (key &optional repository)
|
||||
"Delete the repository-local value for KEY.
|
||||
|
||||
Unless specified, REPOSITORY is the current buffer's repository."
|
||||
(let* ((repokey (or repository (magit-repository-local-repository)))
|
||||
(cache (assoc repokey magit-repository-local-cache)))
|
||||
(when cache
|
||||
;; There is no `assoc-delete-all'.
|
||||
(setf (cdr cache)
|
||||
(cl-delete key (cdr cache) :key #'car :test #'equal)))))
|
||||
(when-let ((cache (assoc (or repository
|
||||
(magit-repository-local-repository))
|
||||
magit-repository-local-cache)))
|
||||
;; There is no `assoc-delete-all'.
|
||||
(setf (cdr cache)
|
||||
(cl-delete key (cdr cache) :key #'car :test #'equal))))
|
||||
|
||||
(defmacro magit--with-repository-local-cache (key &rest body)
|
||||
(declare (indent 1) (debug (form body)))
|
||||
(let ((k (cl-gensym)))
|
||||
`(let ((,k ,key))
|
||||
(if-let ((kv (magit-repository-local-exists-p ,k)))
|
||||
(cdr kv)
|
||||
(let ((v ,(macroexp-progn body)))
|
||||
(magit-repository-local-set ,k v)
|
||||
v)))))
|
||||
|
||||
(defun magit-preserve-section-visibility-cache ()
|
||||
(when (derived-mode-p 'magit-status-mode 'magit-refs-mode)
|
||||
|
||||
Reference in New Issue
Block a user