update packages and add valign
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; magit-mode.el --- Create and refresh Magit buffers -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2008-2025 The Magit Project Contributors
|
||||
;; Copyright (C) 2008-2026 The Magit Project Contributors
|
||||
|
||||
;; Author: Jonas Bernoulli <emacs.magit@jonas.bernoulli.dev>
|
||||
;; Maintainer: Jonas Bernoulli <emacs.magit@jonas.bernoulli.dev>
|
||||
@@ -51,6 +51,8 @@
|
||||
(declare-function magit-wip-get-ref "magit-wip" ())
|
||||
(declare-function magit-wip-commit-worktree "magit-wip" (ref files msg))
|
||||
|
||||
(declare-function magit--blob-cache-zap "magit-files" ())
|
||||
|
||||
;;; Options
|
||||
|
||||
(defcustom magit-mode-hook nil
|
||||
@@ -578,35 +580,41 @@ Magit is documented in info node `(magit)'."
|
||||
|
||||
;;; Local Variables
|
||||
|
||||
(defvar-local magit-buffer-arguments nil)
|
||||
(defvar-local magit-buffer-diff-type nil)
|
||||
(defvar-local magit-buffer-diff-args nil)
|
||||
(defvar-local magit-buffer-diff-files nil)
|
||||
(defvar-local magit-buffer-diff-files-suspended nil)
|
||||
(defvar-local magit-buffer-file-name nil)
|
||||
(defvar-local magit-buffer-files nil)
|
||||
(defvar-local magit-buffer-log-args nil)
|
||||
(defvar-local magit-buffer-log-files nil)
|
||||
(defvar-local magit-buffer-range nil)
|
||||
(defvar-local magit-buffer-range-hashed nil)
|
||||
(defvar-local magit-buffer-refname nil)
|
||||
(defvaralias 'magit-buffer-refname 'magit-buffer-revision)
|
||||
(defvar-local magit-buffer-revision nil)
|
||||
(defvar-local magit-buffer-revision-hash nil)
|
||||
(defvar-local magit-buffer-revisions nil)
|
||||
(defvar-local magit-buffer-typearg nil)
|
||||
(defvar-local magit-buffer-upstream nil)
|
||||
(defvar-local magit-buffer-revision-oid nil)
|
||||
(defvar-local magit-buffer-blob-oid nil)
|
||||
(defvar-local magit-buffer-file-name nil)
|
||||
|
||||
;; These variables are also used in file-visiting buffers.
|
||||
;; Because the user may change the major-mode, they have
|
||||
;; to be permanent buffer-local.
|
||||
(put 'magit-buffer-file-name 'permanent-local t)
|
||||
(put 'magit-buffer-refname 'permanent-local t)
|
||||
;; Preserve when major-mode is changed in file-visiting buffers.
|
||||
(put 'magit-buffer-revision 'permanent-local t)
|
||||
(put 'magit-buffer-revision-hash 'permanent-local t)
|
||||
(put 'magit-buffer-revision-oid 'permanent-local t)
|
||||
(put 'magit-buffer-blob-oid 'permanent-local t)
|
||||
(put 'magit-buffer-file-name 'permanent-local t)
|
||||
|
||||
;; `magit-status' re-enables mode function but its refresher
|
||||
;; function does not reinstate this.
|
||||
(put 'magit-buffer-diff-files-suspended 'permanent-local t)
|
||||
(eval-and-compile
|
||||
(defvar magit-define-aliases-for:magit-buffer-* t)
|
||||
(when magit-define-aliases-for:magit-buffer-*
|
||||
;; Unfortunately defvar-local can only be used at top-level,
|
||||
;; so instead we have to use make-variable-buffer-local below.
|
||||
(defvar magit-buffer-arguments nil)
|
||||
(make-obsolete-variable 'magit-buffer-arguments
|
||||
"use a mode- or package-specific `magit-buffer-{*}-args' instead"
|
||||
"magit 4.6.0")
|
||||
(defvar magit-buffer-upstream nil)
|
||||
(make-obsolete-variable 'magit-buffer-upstream
|
||||
"use a mode- or package-specific `magit-buffer-{*}-upstream' instead"
|
||||
"magit 4.6.0")
|
||||
(define-obsolete-variable-alias 'magit-buffer-range-hashed
|
||||
'magit-buffer-diff-range-oids "magit 4.6.0")
|
||||
(define-obsolete-variable-alias 'magit-buffer-revisions
|
||||
'magit-buffer-log-revisions "magit 4.6.0")
|
||||
(define-obsolete-variable-alias 'magit-buffer-revision-hash
|
||||
'magit-buffer-revision-oid "magit 4.6.0")
|
||||
(define-obsolete-variable-alias 'magit-buffer-typearg
|
||||
'magit-buffer-diff-typearg "magit 4.6.0")))
|
||||
(make-variable-buffer-local 'magit-buffer-arguments)
|
||||
(make-variable-buffer-local 'magit-buffer-upstream)
|
||||
|
||||
(defun magit-buffer-file-name ()
|
||||
"Return `magit-buffer-file-name' or if that is nil `buffer-file-name'.
|
||||
@@ -617,6 +625,7 @@ In an indirect buffer get the value for its base buffer."
|
||||
(defun magit-buffer-revision ()
|
||||
"Return `magit-buffer-revision' or if that is nil \"{worktree}\".
|
||||
If not visiting a blob or file, or the file isn't being tracked,
|
||||
return nil. If visiting a blob but `magit-buffer-revision' is nil,
|
||||
return nil."
|
||||
(or magit-buffer-revision
|
||||
(and buffer-file-name
|
||||
@@ -1098,21 +1107,21 @@ The arguments are for internal use."
|
||||
(when magit-refresh-verbose
|
||||
(message "%s buffer `%s'..." action (buffer-name)))
|
||||
(cond
|
||||
(created
|
||||
(funcall refresh)
|
||||
(cond (initial-section (funcall initial-section))
|
||||
(select-section (funcall select-section))))
|
||||
(t
|
||||
(deactivate-mark)
|
||||
(setq magit-section-pre-command-section nil)
|
||||
(setq magit-section-highlight-overlays nil)
|
||||
(setq magit-section-selection-overlays nil)
|
||||
(setq magit-section-highlighted-sections nil)
|
||||
(setq magit-section-focused-sections nil)
|
||||
(let ((positions (magit--refresh-buffer-get-positions)))
|
||||
(funcall refresh)
|
||||
(cond (select-section (funcall select-section))
|
||||
((magit--refresh-buffer-set-positions positions))))))
|
||||
(created
|
||||
(funcall refresh)
|
||||
(cond (initial-section (funcall initial-section))
|
||||
(select-section (funcall select-section))))
|
||||
(t
|
||||
(deactivate-mark)
|
||||
(setq magit-section-pre-command-section nil)
|
||||
(setq magit-section-highlight-overlays nil)
|
||||
(setq magit-section-selection-overlays nil)
|
||||
(setq magit-section-highlighted-sections nil)
|
||||
(setq magit-section-focused-sections nil)
|
||||
(let ((positions (magit--refresh-buffer-get-positions)))
|
||||
(funcall refresh)
|
||||
(cond (select-section (funcall select-section))
|
||||
((magit--refresh-buffer-set-positions positions))))))
|
||||
(let ((magit-section-cache-visibility nil))
|
||||
(magit-section-show magit-root-section))
|
||||
(run-hooks 'magit-refresh-buffer-hook)
|
||||
@@ -1179,7 +1188,21 @@ The arguments are for internal use."
|
||||
;; for the wrong buffer. Originally reported in #4196 and
|
||||
;; fixed with 482c25a3204468a4f6c2fe12ff061666b61f5f4d.
|
||||
(let ((magit-section-movement-hook nil))
|
||||
(magit-section-goto-successor section line char)))))
|
||||
(magit-section-goto-successor section line char)
|
||||
;; To store the point value for the selected window, it isn't
|
||||
;; enough for it to be current, the window has to "display" it.
|
||||
;; The effect of `goto-char', used by the above function, is not
|
||||
;; preserved, and using just `set-window-point' would affect the
|
||||
;; wrong buffer.
|
||||
(unless (eq (window-dedicated-p) t)
|
||||
(let ((restore (window-buffer))
|
||||
(window-scroll-functions nil)
|
||||
(window-configuration-change-hook nil))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(set-window-buffer nil (current-buffer) t)
|
||||
(set-window-point nil (point)))
|
||||
(set-window-buffer nil restore t))))))))
|
||||
|
||||
(defun magit-revert-buffer (_ignore-auto _noconfirm)
|
||||
"Wrapper around `magit-refresh-buffer' suitable as `revert-buffer-function'."
|
||||
@@ -1539,13 +1562,14 @@ repositories."
|
||||
"Zap caches for the current repository.
|
||||
|
||||
Remove the repository's entry from `magit-repository-local-cache',
|
||||
remove the host's entry from `magit--host-git-version-cache', and
|
||||
set `magit-section-visibility-cache' to nil for all Magit buffers
|
||||
of the repository.
|
||||
remove the host's entry from `magit--host-git-version-cache', set
|
||||
`magit-section-visibility-cache' to nil for all Magit buffers of
|
||||
the repository, and empty the `magit--blob-cache'.
|
||||
|
||||
With a prefix argument or if optional ALL is non-nil, discard the
|
||||
mentioned caches completely."
|
||||
(interactive)
|
||||
(magit--blob-cache-zap)
|
||||
(cond (all
|
||||
(setq magit-repository-local-cache nil)
|
||||
(setq magit--host-git-version-cache nil)
|
||||
@@ -1580,21 +1604,21 @@ The additional output can be found in the *Messages* buffer."
|
||||
|
||||
(defun magit-run-hook-with-benchmark (hook)
|
||||
(cond
|
||||
((not hook))
|
||||
(magit-refresh-verbose
|
||||
(message "Running %s..." hook)
|
||||
(message "Running %s...done (%.3fs)" hook
|
||||
(benchmark-elapse
|
||||
(run-hook-wrapped
|
||||
hook
|
||||
(lambda (fn)
|
||||
(message " %-50s %f" fn (benchmark-elapse (funcall fn))))))))
|
||||
((run-hooks hook))))
|
||||
((not hook))
|
||||
(magit-refresh-verbose
|
||||
(message "Running %s..." hook)
|
||||
(message "Running %s...done (%.3fs)" hook
|
||||
(benchmark-elapse
|
||||
(run-hook-wrapped
|
||||
hook
|
||||
(lambda (fn)
|
||||
(message " %-50s %f" fn (benchmark-elapse (funcall fn))))))))
|
||||
((run-hooks hook))))
|
||||
|
||||
(defun magit-file-region-line-numbers ()
|
||||
"Return the bounds of the region as line numbers.
|
||||
The returned value has the form (BEGINNING-LINE END-LINE). If
|
||||
the region end at the beginning of a line, do not include that
|
||||
the region ends at the beginning of a line, do not include that
|
||||
line. Avoid including the line after the end of the file."
|
||||
(and (magit-buffer-file-name)
|
||||
(region-active-p)
|
||||
@@ -1615,6 +1639,7 @@ line. Avoid including the line after the end of the file."
|
||||
;; ("and>" . "cond-let--and>")
|
||||
;; ("and-let" . "cond-let--and-let")
|
||||
;; ("if-let" . "cond-let--if-let")
|
||||
;; ("when$" . "cond-let--when$")
|
||||
;; ("when-let" . "cond-let--when-let")
|
||||
;; ("while-let" . "cond-let--while-let")
|
||||
;; ("match-string" . "match-string")
|
||||
|
||||
Reference in New Issue
Block a user