update of packages

This commit is contained in:
2023-11-04 19:26:41 +01:00
parent e162a12b58
commit 3b54a3236d
726 changed files with 297673 additions and 34585 deletions

View File

@@ -1,6 +1,6 @@
;;; magit-files.el --- Finding files -*- lexical-binding:t -*-
;; Copyright (C) 2008-2022 The Magit Project Contributors
;; Copyright (C) 2008-2023 The Magit Project Contributors
;; Author: Jonas Bernoulli <jonas@bernoul.li>
;; Maintainer: Jonas Bernoulli <jonas@bernoul.li>
@@ -179,12 +179,19 @@ then only after asking. A non-nil value for REVERT is ignored if REV is
(after-change-major-mode-hook
(remq 'global-diff-hl-mode-enable-in-buffers
after-change-major-mode-hook)))
(delay-mode-hooks
(normal-mode t)))
(normal-mode t))
(setq buffer-read-only t)
(set-buffer-modified-p nil)
(goto-char (point-min))))
(defun magit--lsp--disable-when-visiting-blob (fn &rest args)
"Do nothing when visiting blob using `magit-find-file' and similar.
See also https://github.com/doomemacs/doomemacs/pull/6309."
(unless magit-buffer-revision
(apply fn args)))
(advice-add 'lsp :around #'magit--lsp--disable-when-visiting-blob)
;;; Find Index
(defvar magit-find-index-hook nil)
@@ -203,7 +210,8 @@ is done using `magit-find-index-noselect'."
(unless (equal magit-buffer-refname "{index}")
(user-error "%s isn't visiting the index" file))
(if (y-or-n-p (format "Update index with contents of %s" (buffer-name)))
(let ((index (make-temp-name (magit-git-dir "magit-update-index-")))
(let ((index (make-temp-name
(expand-file-name "magit-update-index-" (magit-gitdir))))
(buffer (current-buffer)))
(when magit-wip-before-change-mode
(magit-wip-commit-before-change (list file) " before un-/stage"))
@@ -226,8 +234,9 @@ is done using `magit-find-index-noselect'."
(when magit-wip-after-apply-mode
(magit-wip-commit-after-apply (list file) " after un-/stage")))
(message "Abort")))
(--when-let (magit-get-mode-buffer 'magit-status-mode)
(with-current-buffer it (magit-refresh)))
(when-let ((buffer (magit-get-mode-buffer 'magit-status-mode)))
(with-current-buffer buffer
(magit-refresh)))
t)
;;; Find Config File
@@ -243,7 +252,7 @@ This command is like `find-file', except that it temporarily
binds `default-directory' to the actual git directory, while
reading the FILENAME."
(interactive
(let ((default-directory (magit-git-dir)))
(let ((default-directory (magit-gitdir)))
(find-file-read-args "Find file: "
(confirm-nonexistent-file-or-buffer))))
(find-file filename wildcards))
@@ -259,7 +268,7 @@ This command is like `find-file-other-window', except that it
temporarily binds `default-directory' to the actual git
directory, while reading the FILENAME."
(interactive
(let ((default-directory (magit-git-dir)))
(let ((default-directory (magit-gitdir)))
(find-file-read-args "Find file in other window: "
(confirm-nonexistent-file-or-buffer))))
(find-file-other-window filename wildcards))
@@ -275,7 +284,7 @@ This command is like `find-file-other-frame', except that it
temporarily binds `default-directory' to the actual git
directory, while reading the FILENAME."
(interactive
(let ((default-directory (magit-git-dir)))
(let ((default-directory (magit-gitdir)))
(find-file-read-args "Find file in other frame: "
(confirm-nonexistent-file-or-buffer))))
(find-file-other-frame filename wildcards))
@@ -288,50 +297,61 @@ directory, while reading the FILENAME."
When invoked outside a file-visiting buffer, then fall back
to `magit-dispatch'."
:info-manual "(magit) Minor Mode for Buffers Visiting Files"
["Actions"
[("s" "Stage" magit-stage-file)
("u" "Unstage" magit-unstage-file)
("c" "Commit" magit-commit)
("e" "Edit line" magit-edit-line-commit)]
[("D" "Diff..." magit-diff)
("d" "Diff" magit-diff-buffer-file)
("g" "Status" magit-status-here)]
[("L" "Log..." magit-log)
[:if magit-file-relative-name
["File actions"
(" s" "Stage" magit-stage-buffer-file)
(" u" "Unstage" magit-unstage-buffer-file)
(", x" "Untrack" magit-file-untrack)
(", r" "Rename" magit-file-rename)
(", k" "Delete" magit-file-delete)
(", c" "Checkout" magit-file-checkout)]
["Inspect"
("D" "Diff..." magit-diff)
("d" "Diff" magit-diff-buffer-file)]
[""
("L" "Log..." magit-log)
("l" "Log" magit-log-buffer-file)
("t" "Trace" magit-log-trace-definition)
(7 "M" "Merged" magit-log-merged)]
[("B" "Blame..." magit-blame)
[""
("B" "Blame..." magit-blame)
("b" "Blame" magit-blame-addition)
("r" "...removal" magit-blame-removal)
("f" "...reverse" magit-blame-reverse)
("m" "Blame echo" magit-blame-echo)
("q" "Quit blame" magit-blame-quit)]
[("p" "Prev blob" magit-blob-previous)
("n" "Next blob" magit-blob-next)
("v" "Goto blob" magit-find-file)
("V" "Goto file" magit-blob-visit-file)]
[(5 "C-c r" "Rename file" magit-file-rename)
(5 "C-c d" "Delete file" magit-file-delete)
(5 "C-c u" "Untrack file" magit-file-untrack)
(5 "C-c c" "Checkout file" magit-file-checkout)]]
(interactive)
(transient-setup
(if (magit-file-relative-name)
'magit-file-dispatch
'magit-dispatch)))
["Navigate"
("p" "Prev blob" magit-blob-previous)
("n" "Next blob" magit-blob-next)
("v" "Goto blob" magit-find-file)
("V" "Goto file" magit-blob-visit-file)
("g" "Goto status" magit-status-here)
("G" "Goto magit" magit-display-repository-buffer)]
["More actions"
("c" "Commit" magit-commit)
("e" "Edit line" magit-edit-line-commit)]]
[:if-not magit-file-relative-name
["File actions"
("s" "Stage" magit-stage-file)
("u" "Unstage" magit-unstage-file)
("x" "Untrack" magit-file-untrack)
("r" "Rename" magit-file-rename)
("k" "Delete" magit-file-delete)
("c" "Checkout" magit-file-checkout)]
["Navigate"
("g" "Goto status" magit-status-here :if-not-mode magit-status-mode)
("G" "Goto magit" magit-display-repository-buffer)]])
;;; Blob Mode
(defvar magit-blob-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "p" #'magit-blob-previous)
(define-key map "n" #'magit-blob-next)
(define-key map "b" #'magit-blame-addition)
(define-key map "r" #'magit-blame-removal)
(define-key map "f" #'magit-blame-reverse)
(define-key map "q" #'magit-kill-this-buffer)
map)
"Keymap for `magit-blob-mode'.")
(defvar-keymap magit-blob-mode-map
:doc "Keymap for `magit-blob-mode'."
"p" #'magit-blob-previous
"n" #'magit-blob-next
"b" #'magit-blame-addition
"r" #'magit-blame-removal
"f" #'magit-blame-reverse
"q" #'magit-kill-this-buffer)
(define-minor-mode magit-blob-mode
"Enable some Magit features in blob-visiting buffers.
@@ -356,8 +376,8 @@ Currently this only adds the following key bindings.
(interactive)
(if-let ((file (or magit-buffer-file-name
(buffer-file-name (buffer-base-buffer)))))
(--if-let (magit-blob-ancestor magit-buffer-revision file)
(magit-blob-visit it)
(if-let ((ancestor (magit-blob-ancestor magit-buffer-revision file)))
(magit-blob-visit ancestor)
(user-error "You have reached the beginning of time"))
(user-error "Buffer isn't visiting a file or blob")))
@@ -419,7 +439,7 @@ Git, fallback to using `rename-file'."
(user-error "%s already exists" dstfile))
(unless (file-exists-p dstdir)
(user-error "Destination directory %s does not exist" dstdir))
(if (magit-file-tracked-p (magit-convert-filename-for-git file))
(if (magit-file-tracked-p file)
(magit-call-git "mv"
(magit-convert-filename-for-git file)
(magit-convert-filename-for-git newname))
@@ -439,11 +459,10 @@ Git, fallback to using `rename-file'."
With a prefix argument FORCE do so even when the files have
staged as well as unstaged changes."
(interactive (list (or (--if-let (magit-region-values 'file t)
(progn
(unless (magit-file-tracked-p (car it))
(user-error "Already untracked"))
(magit-confirm-files 'untrack it "Untrack"))
(interactive (list (or (if-let ((files (magit-region-values 'file t)))
(if (magit-file-tracked-p (car files))
(magit-confirm-files 'untrack files "Untrack")
(user-error "Already untracked"))
(list (magit-read-tracked-file "Untrack file"))))
current-prefix-arg))
(magit-with-toplevel
@@ -455,8 +474,8 @@ staged as well as unstaged changes."
With a prefix argument FORCE do so even when the files have
uncommitted changes. When the files aren't being tracked in
Git, then fallback to using `delete-file'."
(interactive (list (--if-let (magit-region-values 'file t)
(magit-confirm-files 'delete it "Delete")
(interactive (list (if-let ((files (magit-region-values 'file t)))
(magit-confirm-files 'delete files "Delete")
(list (magit-read-file "Delete file")))
current-prefix-arg))
(if (magit-file-tracked-p (car files))
@@ -487,13 +506,15 @@ Git, then fallback to using `delete-file'."
(car (member (or default (magit-current-file)) files)))))
(defun magit-read-file (prompt &optional tracked-only)
(let ((choices (nconc (magit-list-files)
(unless tracked-only (magit-untracked-files)))))
(magit-completing-read
prompt choices nil t nil nil
(car (member (or (magit-section-value-if '(file submodule))
(magit-file-relative-name nil tracked-only))
choices)))))
(magit-with-toplevel
(let ((choices (nconc (magit-list-files)
(and (not tracked-only)
(magit-untracked-files)))))
(magit-completing-read
prompt choices nil t nil nil
(car (member (or (magit-section-value-if '(file submodule))
(magit-file-relative-name nil tracked-only))
choices))))))
(defun magit-read-tracked-file (prompt)
(magit-read-file prompt t))