From 28a8b344e01c82a62675d4d3db0e559abcc14238 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Wed, 21 May 2025 14:51:44 +0200 Subject: [PATCH] update magit --- elpa/magit-20250519.1537/.dir-locals.el | 15 + .../AUTHORS.md | 8 + .../LICENSE | 0 .../dir | 0 .../git-commit.el | 51 +- .../git-rebase.el | 35 +- .../magit-apply.el | 177 +-- .../magit-autoloads.el | 274 ++-- .../magit-autorevert.el | 13 +- .../magit-base.el | 154 +- .../magit-bisect.el | 10 +- .../magit-blame.el | 53 +- .../magit-bookmark.el | 4 +- .../magit-branch.el | 83 +- .../magit-bundle.el | 7 + .../magit-clone.el | 14 +- .../magit-commit.el | 250 +++- .../magit-core.el | 0 .../magit-diff.el | 621 ++++---- elpa/magit-20250519.1537/magit-dired.el | 109 ++ .../magit-ediff.el | 9 +- .../magit-extras.el | 75 +- .../magit-fetch.el | 4 +- .../magit-files.el | 77 +- .../magit-git.el | 308 ++-- .../magit-gitignore.el | 18 +- .../magit-log.el | 337 +++-- .../magit-margin.el | 20 +- .../magit-merge.el | 26 +- .../magit-mode.el | 180 ++- .../magit-notes.el | 4 +- .../magit-patch.el | 6 +- .../magit-pkg.el | 14 +- .../magit-process.el | 144 +- .../magit-pull.el | 0 .../magit-push.el | 14 +- .../magit-reflog.el | 0 .../magit-refs.el | 45 +- .../magit-remote.el | 38 +- .../magit-repos.el | 83 +- .../magit-reset.el | 0 .../magit-sequence.el | 177 ++- .../magit-sparse-checkout.el | 2 +- .../magit-stash.el | 38 +- .../magit-status.el | 250 ++-- .../magit-submodule.el | 76 +- .../magit-subtree.el | 16 +- .../magit-tag.el | 2 +- .../magit-transient.el | 102 +- .../magit-wip.el | 54 +- .../magit-worktree.el | 4 +- .../magit.el | 47 +- .../magit.info | 1255 ++++++++++------- .../dir | 0 .../magit-section-autoloads.el | 0 .../magit-section-pkg.el | 10 +- .../magit-section.el | 605 ++++---- .../magit-section.info | 2 +- 58 files changed, 3301 insertions(+), 2619 deletions(-) create mode 100644 elpa/magit-20250519.1537/.dir-locals.el rename elpa/{magit-20250107.2324 => magit-20250519.1537}/AUTHORS.md (98%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/LICENSE (100%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/dir (100%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/git-commit.el (97%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/git-rebase.el (97%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-apply.el (87%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-autoloads.el (91%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-autorevert.el (96%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-base.el (92%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-bisect.el (97%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-blame.el (96%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-bookmark.el (97%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-branch.el (94%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-bundle.el (97%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-clone.el (97%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-commit.el (77%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-core.el (100%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-diff.el (89%) create mode 100644 elpa/magit-20250519.1537/magit-dired.el rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-ediff.el (99%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-extras.el (92%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-fetch.el (98%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-files.el (93%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-git.el (93%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-gitignore.el (94%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-log.el (89%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-margin.el (94%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-merge.el (95%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-mode.el (91%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-notes.el (97%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-patch.el (98%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-pkg.el (68%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-process.el (93%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-pull.el (100%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-push.el (97%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-reflog.el (100%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-refs.el (96%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-remote.el (93%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-repos.el (90%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-reset.el (100%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-sequence.el (90%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-sparse-checkout.el (99%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-stash.el (96%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-status.el (81%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-submodule.el (93%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-subtree.el (94%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-tag.el (99%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-transient.el (73%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-wip.el (94%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit-worktree.el (98%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit.el (96%) rename elpa/{magit-20250107.2324 => magit-20250519.1537}/magit.info (95%) rename elpa/{magit-section-20250107.641 => magit-section-20250518.653}/dir (100%) rename elpa/{magit-section-20250107.641 => magit-section-20250518.653}/magit-section-autoloads.el (100%) rename elpa/{magit-section-20250107.641 => magit-section-20250518.653}/magit-section-pkg.el (66%) rename elpa/{magit-section-20250107.641 => magit-section-20250518.653}/magit-section.el (85%) rename elpa/{magit-section-20250107.641 => magit-section-20250518.653}/magit-section.info (99%) diff --git a/elpa/magit-20250519.1537/.dir-locals.el b/elpa/magit-20250519.1537/.dir-locals.el new file mode 100644 index 00000000..ea760dc2 --- /dev/null +++ b/elpa/magit-20250519.1537/.dir-locals.el @@ -0,0 +1,15 @@ +((nil + (indent-tabs-mode . nil)) + (makefile-mode + (indent-tabs-mode . t) + (outline-regexp . "#\\(#+\\)") + (mode . outline-minor)) + (emacs-lisp-mode + (checkdoc-allow-quoting-nil-and-t . t)) + (git-commit-mode + (git-commit-major-mode . git-commit-elisp-text-mode)) + (".github/PULL_REQUEST_TEMPLATE" + (nil (truncate-lines . nil))) + ("CHANGELOG" + (nil (fill-column . 70) + (mode . display-fill-column-indicator)))) diff --git a/elpa/magit-20250107.2324/AUTHORS.md b/elpa/magit-20250519.1537/AUTHORS.md similarity index 98% rename from elpa/magit-20250107.2324/AUTHORS.md rename to elpa/magit-20250519.1537/AUTHORS.md index 15c67bab..e0b88d92 100644 --- a/elpa/magit-20250107.2324/AUTHORS.md +++ b/elpa/magit-20250519.1537/AUTHORS.md @@ -103,6 +103,7 @@ All Contributors - Clément Pit-Claudel - Cornelius Mika - Craig Andera +- Curt Brune - Daanturo - Dale Hagglund - Damien Cassou @@ -153,6 +154,7 @@ All Contributors - Frédéric Giquel - Fritz Grabo - Fritz Stelzer +- gemmaro - Geoff Shannon - George Kadianakis - Géza Herman @@ -171,10 +173,12 @@ All Contributors - Ian Eure - Ian Milligan - Ilya Grigoriev +- Iñaki Arenaza - Ingmar Sittl - Ingo Lohmar - Ioan-Adrian Ratiu - Ivan Brennan +- Jacob Ilsø - Jan Tatarik - Jasper St. Pierre - JD Smith @@ -283,6 +287,7 @@ All Contributors - Nicolas Dudebout - Nicolas Petton - Nicolas Richard +- Nikita Leshenko - Nikolay Martynov - Noam Postavsky - N. Troy de Freitas @@ -297,6 +302,7 @@ All Contributors - Paul Stadig - Pavel Holejsovsky - Pekka Pessi +- Pengji Zhang - Peter Eisentraut - Peter Jaros - Peter J. Weisberg @@ -325,6 +331,7 @@ All Contributors - Rémi Vanicat - René Stadler - Richard Kim +- Richard Sent - Robert Boone - Robert Irelan - Robin Green @@ -402,6 +409,7 @@ All Contributors - Win Treese - Wojciech Siewierski - Wouter Bolsterlee +- X4lldux - Xavier Noria - Xu Chunyang - Yann Herklotz diff --git a/elpa/magit-20250107.2324/LICENSE b/elpa/magit-20250519.1537/LICENSE similarity index 100% rename from elpa/magit-20250107.2324/LICENSE rename to elpa/magit-20250519.1537/LICENSE diff --git a/elpa/magit-20250107.2324/dir b/elpa/magit-20250519.1537/dir similarity index 100% rename from elpa/magit-20250107.2324/dir rename to elpa/magit-20250519.1537/dir diff --git a/elpa/magit-20250107.2324/git-commit.el b/elpa/magit-20250519.1537/git-commit.el similarity index 97% rename from elpa/magit-20250107.2324/git-commit.el rename to elpa/magit-20250519.1537/git-commit.el index d1cbd9ba..206cef88 100644 --- a/elpa/magit-20250107.2324/git-commit.el +++ b/elpa/magit-20250519.1537/git-commit.el @@ -174,19 +174,21 @@ full loading." The major mode configured here is turned on by the minor mode `git-commit-mode'." :group 'git-commit - :type '(choice (function-item text-mode) - (function-item markdown-mode) - (function-item org-mode) - (function-item fundamental-mode) - (function-item git-commit-elisp-text-mode) - (function :tag "Another mode") - (const :tag "No major mode"))) + :type '(radio (function-item text-mode) + (function-item markdown-mode) + (function-item org-mode) + (function-item fundamental-mode) + (function-item log-edit-mode) + (function-item git-commit-elisp-text-mode) + (function :tag "Another mode") + (const :tag "No major mode"))) ;;;###autoload(put 'git-commit-major-mode 'safe-local-variable ;;;###autoload (lambda (val) ;;;###autoload (memq val '(text-mode ;;;###autoload markdown-mode ;;;###autoload org-mode ;;;###autoload fundamental-mode +;;;###autoload log-edit-mode ;;;###autoload git-commit-elisp-text-mode)))) (defvaralias 'git-commit-mode-hook 'git-commit-setup-hook @@ -194,12 +196,12 @@ The major mode configured here is turned on by the minor mode Also note that `git-commit-mode' (which see) is not a major-mode.") (defcustom git-commit-setup-hook - '(git-commit-ensure-comment-gap - git-commit-save-message - git-commit-setup-changelog-support - git-commit-turn-on-auto-fill - git-commit-propertize-diff - bug-reference-mode) + (list #'git-commit-ensure-comment-gap + #'git-commit-save-message + #'git-commit-setup-changelog-support + #'git-commit-turn-on-auto-fill + #'git-commit-propertize-diff + #'bug-reference-mode) "Hook run at the end of `git-commit-setup'." :group 'git-commit :type 'hook @@ -245,7 +247,7 @@ commit, then the hook is not run at all." :type 'number) (defcustom git-commit-finish-query-functions - '(git-commit-check-style-conventions) + (list #'git-commit-check-style-conventions) "List of functions called to query before performing commit. The commit message buffer is current while the functions are @@ -300,7 +302,7 @@ See also manpage git-interpret-trailer(1). This package does not use that Git command, but the initial description still serves as a good introduction." :group 'git-commit - :safe (lambda (val) (and (listp val) (seq-every-p #'stringp val))) + :safe (##and (listp %) (seq-every-p #'stringp %)) :type '(repeat string)) (defcustom git-commit-use-local-message-ring nil @@ -434,7 +436,7 @@ the redundant bindings, then set this to nil, before loading (require 'easymenu) (easy-menu-define git-commit-mode-menu git-commit-mode-map - "Git Commit Mode Menu" + "Git Commit Mode Menu." '("Commit" ["Previous" git-commit-prev-message t] ["Next" git-commit-next-message t] @@ -658,7 +660,7 @@ the input isn't tacked to the comment." (defun git-commit-turn-on-auto-fill () "Unconditionally turn on Auto Fill mode. Ensure auto filling happens everywhere, except in the summary line." - (turn-on-auto-fill) + (auto-fill-mode 1) (setq-local comment-auto-fill-only-comments nil) (when git-commit-need-summary-line (setq-local auto-fill-function #'git-commit-auto-fill-except-summary))) @@ -683,7 +685,7 @@ Also check text that is already in the buffer, while avoiding to check most text that Git will strip from the final message, such as the last comment and anything below the cut line (\"--- >8 ---\")." (require 'flyspell) - (turn-on-flyspell) + (flyspell-mode 1) (setq flyspell-generic-check-word-predicate #'git-commit-flyspell-verify) (let ((end nil) @@ -846,10 +848,9 @@ Save current message first." See also manpage git-interpret-trailer(1). This command does not use that Git command, but the initial description still serves as a good introduction." - [[:description (lambda () - (cond (prefix-arg + [[:description (##cond (prefix-arg "Insert ... by someone ") - ("Insert ... by yourself"))) + ("Insert ... by yourself")) ("a" "Ack" git-commit-ack) ("m" "Modified" git-commit-modified) ("r" "Reviewed" git-commit-review) @@ -1048,10 +1049,10 @@ Added to `font-lock-extend-region-functions'." (defconst git-commit-font-lock-keywords-1 '(;; Trailers (eval . `(,(git-commit--trailer-regexp) - (1 'git-commit-trailer-token) - (2 'git-commit-trailer-value) - (3 'git-commit-trailer-token) - (4 'git-commit-trailer-value))) + (1 'git-commit-trailer-token nil t) + (2 'git-commit-trailer-value nil t) + (3 'git-commit-trailer-token nil t) + (4 'git-commit-trailer-value nil t))) ;; Summary (eval . `(,(git-commit-summary-regexp) (1 'git-commit-summary))) diff --git a/elpa/magit-20250107.2324/git-rebase.el b/elpa/magit-20250519.1537/git-rebase.el similarity index 97% rename from elpa/magit-20250107.2324/git-rebase.el rename to elpa/magit-20250519.1537/git-rebase.el index e408408e..65441f89 100644 --- a/elpa/magit-20250107.2324/git-rebase.el +++ b/elpa/magit-20250519.1537/git-rebase.el @@ -181,7 +181,7 @@ (put 'git-rebase-kill-line :advertised-binding (kbd "k")) (easy-menu-define git-rebase-mode-menu git-rebase-mode-map - "Git-Rebase mode menu" + "Git-Rebase mode menu." '("Rebase" ["Pick" git-rebase-pick t] ["Reword" git-rebase-reword t] @@ -275,7 +275,8 @@ If the region is active, act on all lines touched by the region." (action-options :initarg :action-options :initform nil) (target :initarg :target :initform nil) (trailer :initarg :trailer :initform nil) - (comment-p :initarg :comment-p :initform nil))) + (comment-p :initarg :comment-p :initform nil) + (abbrev))) (defvar git-rebase-line-regexps `((commit . ,(concat @@ -329,8 +330,8 @@ instance with all nil values is returned." "Set action of commit line to ACTION. If the region is active, operate on all lines that it touches. Otherwise, operate on the current line. As a special case, an -ACTION of nil comments the rebase line, regardless of its action -type." +ACTION of nil comments or uncomments the rebase line, regardless +of its action type." (pcase (git-rebase-region-bounds t) (`(,beg ,end) (let ((end-marker (copy-marker end)) @@ -345,9 +346,11 @@ type." (let ((inhibit-read-only t)) (magit-delete-line) (insert (concat action " " target " " trailer "\n")))) - ((and action-type (not (or action comment-p))) + ((and (not action) action-type) (let ((inhibit-read-only t)) - (insert comment-start " ")) + (if comment-p + (delete-region beg (+ beg 2)) + (insert comment-start " "))) (forward-line)) (t ;; In the case of --rebase-merges, commit lines may have @@ -441,8 +444,8 @@ current line." (bounds (git-rebase-region-bounds))) (mapc #'delete-overlay magit-section-highlight-overlays) (when bounds - (magit-section-make-overlay (car bounds) (cadr bounds) - 'magit-section-heading-selection)) + (magit-section-highlight-range (car bounds) (cadr bounds) + 'magit-section-heading-selection)) (if (and bounds (not magit-section-keep-region-overlay)) (funcall (default-value 'redisplay-unhighlight-region-function) rol) (funcall (default-value 'redisplay-highlight-region-function) @@ -453,7 +456,8 @@ current line." (funcall (default-value 'redisplay-unhighlight-region-function) rol)) (defun git-rebase-kill-line () - "Kill the current action line. + "Comment the current action line. +If the action line is already commented, then uncomment it. If the region is active, act on all lines touched by the region." (interactive) (git-rebase-set-action nil)) @@ -588,8 +592,7 @@ commit. For an upper-case -C, the message will be used as is." (insert (format "merge %s %s %s\n" (replace-regexp-in-string - "-[cC]" (lambda (c) - (if (equal c "-c") "-C" "-c")) + "-[cC]" (##if (equal % "-c") "-C" "-c") action-options t t) target trailer))) @@ -776,7 +779,7 @@ running \"man git-rebase\" at the command line) for details." (git-rebase-match-comment-line 0 'font-lock-comment-face) ("\\[[^[]*\\]" 0 'magit-keyword t) - ("\\(?:fixup!\\|squash!\\)" + ("\\(?:fixup!\\|squash!\\|amend!\\)" 0 'magit-keyword-squash t) (,(format "^%s Rebase \\([^ ]*\\) onto \\([^ ]*\\)" comment-start) (1 'git-rebase-comment-hash t) @@ -787,10 +790,10 @@ running \"man git-rebase\" at the command line) for details." (1 'git-rebase-label t)))) (defun git-rebase-mode-show-keybindings () - "Modify the \"Commands:\" section of the comment Git generates -at the bottom of the file so that in place of the one-letter -abbreviation for the command, it shows the command's keybinding. -By default, this is the same except for the \"pick\" command." + "Modify the \"Commands:\" section of the comment Git generates. +Modify that section to replace Git's one-letter command abbreviation, +with the key bindings used in Magit. By default, these are the same, +except for the \"pick\" command." (let ((inhibit-read-only t)) (save-excursion (goto-char (point-min)) diff --git a/elpa/magit-20250107.2324/magit-apply.el b/elpa/magit-20250519.1537/magit-apply.el similarity index 87% rename from elpa/magit-20250107.2324/magit-apply.el rename to elpa/magit-20250519.1537/magit-apply.el index cbbe2c1b..3f6f5bd0 100644 --- a/elpa/magit-20250107.2324/magit-apply.el +++ b/elpa/magit-20250519.1537/magit-apply.el @@ -137,11 +137,9 @@ so causes the change to be applied to the index as well." (defun magit-apply-diffs (sections &rest args) (setq sections (magit-apply--get-diffs sections)) (magit-apply-patch sections args - (mapconcat - (lambda (s) - (concat (magit-diff-file-header s) - (magit-apply--section-content s))) - sections ""))) + (mapconcat (##concat (magit-diff-file-header %) + (magit-apply--section-content %)) + sections ""))) (defun magit-apply-diff (section &rest args) (setq section (car (magit-apply--get-diffs (list section)))) @@ -217,7 +215,7 @@ adjusted as \"@@ -10,6 +10,7 @@\" and \"@@ -18,6 +19,7 @@\"." (defun magit-apply-patch (section:s args patch) (let* ((files (if (atom section:s) (list (oref section:s value)) - (--map (oref it value) section:s))) + (mapcar (##oref % value) section:s))) (command (symbol-name this-command)) (command (if (and command (string-match "^magit-\\([^-]+\\)" command)) (match-string 1 command) @@ -229,10 +227,11 @@ adjusted as \"@@ -10,6 +10,7 @@\" and \"@@ -18,6 +19,7 @@\"." (magit-wip-commit-before-change files (concat " before " command))) (with-temp-buffer (insert patch) - (magit-run-git-with-input - "apply" args "-p0" - (and ignore-context "-C0") - "--ignore-space-change" "-")) + (let ((magit-inhibit-refresh t)) + (magit-run-git-with-input + "apply" args "-p0" + (and ignore-context "-C0") + "--ignore-space-change" "-"))) (unless magit-inhibit-refresh (when magit-wip-after-apply-mode (magit-wip-commit-after-apply files (concat " after " command))) @@ -243,19 +242,21 @@ adjusted as \"@@ -10,6 +10,7 @@\" and \"@@ -18,6 +19,7 @@\"." (let ((section (magit-current-section))) (pcase (oref section type) ((or 'hunk 'file 'module) section) - ((or 'staged 'unstaged 'untracked + ((or 'staged 'unstaged 'stashed-index 'stashed-worktree 'stashed-untracked) (oref section children)) + ('untracked t) (_ (user-error "Cannot apply this, it's not a change")))))) (defun magit-apply--get-diffs (sections) (magit-section-case ([file diffstat] - (--map (or (magit-get-section - (append `((file . ,(oref it value))) - (magit-section-ident magit-root-section))) - (error "Cannot get required diff headers")) - sections)) + (mapcar (lambda (section) + (or (magit-get-section + (append `((file . ,(oref section value))) + (magit-section-ident magit-root-section))) + (error "Cannot get required diff headers"))) + sections)) (t sections))) (defun magit-apply--ignore-whitespace-p (selection type scope) @@ -272,8 +273,7 @@ return nil, possibly causing whitespace changes to be applied." "--ignore-all-space" "--ignore-blank-lines"))) magit-buffer-diff-args) - (not (cl-find-if (lambda (section) - (oref section binary)) + (not (cl-find-if (##oref % binary) (ensure-list selection))))) ;;;; Stage @@ -302,23 +302,10 @@ at point, stage the file but not its content." (`(staged ,_ ,_) (user-error "Already staged")) (`(committed ,_ ,_) (user-error "Cannot stage committed changes")) (`(undefined ,_ ,_) (user-error "Cannot stage this change"))) - (call-interactively #'magit-stage-file))) + (call-interactively #'magit-stage-files))) ;;;###autoload -(defun magit-stage-buffer-file () - "Stage all changes to the file being visited in the current buffer." - (interactive) - (unless buffer-file-name - (user-error "Not visiting a file")) - (magit-with-toplevel - (magit-stage-1 (and (magit-file-ignored-p buffer-file-name) - (if (y-or-n-p "Visited file is ignored; stage anyway?") - "--force" - (user-error "Abort"))) - (list (magit-file-relative-name))))) - -;;;###autoload -(defun magit-stage-file (files &optional force) +(defun magit-stage-files (files &optional force) "Read one or more files and stage all changes in those files. With prefix argument FORCE, offer ignored files for completion." (interactive @@ -334,10 +321,7 @@ With prefix argument FORCE, offer ignored files for completion." choices nil t nil nil default) current-prefix-arg))) (magit-with-toplevel - ;; For backward compatibility, and because of - ;; the function's name, don't require a list. - (magit-stage-1 (and force "--force") - (ensure-list files)))) + (magit-stage-1 (and force "--force") files))) ;;;###autoload (defun magit-stage-modified (&optional all) @@ -377,39 +361,39 @@ ignored) files." "--" plain) (when magit-auto-revert-mode (mapc #'magit-turn-on-auto-revert-mode-if-desired plain))) - (dolist (repo repos) - (save-excursion - (goto-char (oref (magit-get-section - `((file . ,repo) (untracked) (status))) - start)) - (when (and (fboundp 'borg-assimilate) - (fboundp 'borg--maybe-absorb-gitdir) - (fboundp 'borg--sort-submodule-sections)) - (let* ((topdir (magit-toplevel)) - (url (let ((default-directory - (file-name-as-directory (expand-file-name repo)))) - (or (magit-get "remote" (magit-get-some-remote) "url") - (concat (file-name-as-directory ".") repo)))) - (package - (and (equal borg-user-emacs-directory topdir) - (file-name-nondirectory (directory-file-name repo))))) - (if (and package - (y-or-n-p (format "Also assimilate `%s' drone?" package))) - (borg-assimilate package url) - (magit-submodule-add-1 - url repo (magit-submodule-read-name-for-path repo package)) - (when package - (borg--sort-submodule-sections - (expand-file-name ".gitmodules" topdir)) - (let ((default-directory borg-user-emacs-directory)) - (borg--maybe-absorb-gitdir package)))))))) + (when (and (fboundp 'borg-assimilate) + (fboundp 'borg--maybe-absorb-gitdir) + (fboundp 'borg--sort-submodule-sections)) + (dolist (repo repos) + (save-excursion + (when-let ((section (magit-get-section + `((file . ,repo) (untracked) (status))))) + (goto-char (oref section start)) + (let* ((topdir (magit-toplevel)) + (url (let ((default-directory + (file-name-as-directory (expand-file-name repo)))) + (or (magit-get "remote" (magit-get-some-remote) "url") + (concat (file-name-as-directory ".") repo)))) + (package + (and (equal borg-user-emacs-directory topdir) + (file-name-nondirectory (directory-file-name repo))))) + (if (and package + (y-or-n-p (format "Also assimilate `%s' drone?" package))) + (borg-assimilate package url) + (magit-submodule-add-1 + url repo (magit-submodule-read-name-for-path repo package)) + (when package + (borg--sort-submodule-sections + (expand-file-name ".gitmodules" topdir)) + (let ((default-directory borg-user-emacs-directory)) + (borg--maybe-absorb-gitdir package))))))))) (magit-wip-commit-after-apply files " after stage"))) (defvar magit-post-stage-hook-commands (list #'magit-stage - #'magit-stage-buffer-file - #'magit-stage-file - #'magit-stage-modified)) + #'magit-stage-files + #'magit-stage-modified + 'magit-file-stage)) (defun magit-run-post-stage-hook () (when (memq this-command magit-post-stage-hook-commands) @@ -444,16 +428,7 @@ ignored) files." (`(undefined ,_ ,_) (user-error "Cannot unstage this change"))))) ;;;###autoload -(defun magit-unstage-buffer-file () - "Unstage all changes to the file being visited in the current buffer." - (interactive) - (unless buffer-file-name - (user-error "Not visiting a file")) - (magit-with-toplevel - (magit-unstage-1 (list (magit-file-relative-name))))) - -;;;###autoload -(defun magit-unstage-file (files) +(defun magit-unstage-files (files) "Read one or more files and unstage all changes to those files." (interactive (let* ((choices (magit-staged-files)) @@ -463,9 +438,7 @@ ignored) files." (list (magit-completing-read-multiple "Unstage file,s: " choices nil t nil nil default)))) (magit-with-toplevel - ;; For backward compatibility, and because of - ;; the function's name, don't require a list. - (magit-unstage-1 (ensure-list files)))) + (magit-unstage-1 files))) (defun magit-unstage-1 (files) (magit-wip-commit-before-change files " before unstage") @@ -476,7 +449,7 @@ ignored) files." (defun magit-unstage-intent (files) (if-let ((staged (magit-staged-files)) - (intent (--filter (member it staged) files))) + (intent (seq-filter (##member % staged) files))) (magit-unstage-1 intent) (user-error "Already unstaged"))) @@ -495,9 +468,9 @@ ignored) files." (defvar magit-post-unstage-hook-commands (list #'magit-unstage - #'magit-unstage-buffer-file - #'magit-unstage-file - #'magit-unstage-all)) + #'magit-unstage-files + #'magit-unstage-all + 'magit-file-unstage)) (defun magit-run-post-unstage-hook () (when (memq this-command magit-post-unstage-hook-commands) @@ -514,14 +487,18 @@ of a side, then keep that side without prompting." (interactive) (when-let ((s (magit-apply--get-selection))) (pcase (list (magit-diff-type) (magit-diff-scope)) - (`(committed ,_) (user-error "Cannot discard committed changes")) - (`(undefined ,_) (user-error "Cannot discard this change")) - (`(,_ region) (magit-discard-region s)) - (`(,_ hunk) (magit-discard-hunk s)) - (`(,_ hunks) (magit-discard-hunks s)) - (`(,_ file) (magit-discard-file s)) - (`(,_ files) (magit-discard-files s)) - (`(,_ list) (magit-discard-files s))))) + (`(committed ,_) (user-error "Cannot discard committed changes")) + (`(undefined ,_) (user-error "Cannot discard this change")) + (`(untracked list) (magit-discard-files--delete + (magit-with-toplevel + (magit-untracked-files nil nil "--directory")) + nil)) + (`(,_ region) (magit-discard-region s)) + (`(,_ hunk) (magit-discard-hunk s)) + (`(,_ hunks) (magit-discard-hunks s)) + (`(,_ file) (magit-discard-file s)) + (`(,_ files) (magit-discard-files s)) + (`(,_ list) (magit-discard-files s))))) (defun magit-discard-region (section) (magit-confirm 'discard "Discard region") @@ -622,9 +599,7 @@ of a side, then keep that side without prompting." (magit-read-char-case (format "For these %d files\n%s\ncheckout:\n" (length files) - (mapconcat (lambda (file) - (concat " " file)) - files "\n")) + (mapconcat (##concat " " %) files "\n")) t (?o "[o]ur stage" "--ours") (?t "[t]heir stage" "--theirs") @@ -683,7 +658,7 @@ of a side, then keep that side without prompting." (magit-call-git "reset" "--" orig))))) (defun magit-discard-files--discard (sections new-files) - (let ((files (--map (oref it value) sections))) + (let ((files (mapcar (##oref % value) sections))) (magit-confirm-files 'discard (append files new-files) (format "Discard %s changes in" (magit-diff-type))) (if (eq (magit-diff-type (car sections)) 'unstaged) @@ -694,15 +669,15 @@ of a side, then keep that side without prompting." (let ((binaries (magit-binary-files "--cached"))) (when binaries (setq sections - (--remove (member (oref it value) binaries) - sections))) + (seq-remove (##member (oref % value) binaries) + sections))) (cond ((length= sections 1) (magit-discard-apply (car sections) 'magit-apply-diff)) (sections (magit-discard-apply-n sections #'magit-apply-diffs))) (when binaries (let ((modified (magit-unstaged-files t))) - (setq binaries (--separate (member it modified) binaries))) + (setq binaries (magit--separate (##member % modified) binaries))) (when (cadr binaries) (magit-call-git "reset" "--" (cadr binaries))) (when (car binaries) @@ -756,9 +731,9 @@ so causes the change to be applied to the index as well." magit-buffer-range) (t "--cached"))))) - (--separate (member (oref it value) bs) - sections)))) - (magit-confirm-files 'reverse (--map (oref it value) sections)) + (magit--separate (##member (oref % value) bs) + sections)))) + (magit-confirm-files 'reverse (mapcar (##oref % value) sections)) (cond ((length= sections 1) (magit-reverse-apply (car sections) #'magit-apply-diff args)) (sections diff --git a/elpa/magit-20250107.2324/magit-autoloads.el b/elpa/magit-20250519.1537/magit-autoloads.el similarity index 91% rename from elpa/magit-20250107.2324/magit-autoloads.el rename to elpa/magit-20250519.1537/magit-autoloads.el index d5addfdf..b070d97e 100644 --- a/elpa/magit-20250107.2324/magit-autoloads.el +++ b/elpa/magit-20250519.1537/magit-autoloads.el @@ -17,6 +17,7 @@ markdown-mode org-mode fundamental-mode + log-edit-mode git-commit-elisp-text-mode)))) (register-definition-prefixes "git-commit" '("git-commit-" "global-git-commit-mode")) @@ -52,20 +53,20 @@ the current Emacs session. If the value is nil, no bindings are added. -If `default', maybe add: +If \\+`default', maybe add: - C-x g `magit-status' - C-x M-g `magit-dispatch' - C-c M-g `magit-file-dispatch' + \\`C-x' \\`g' `magit-status' + \\`C-x' \\`M-g' `magit-dispatch' + \\`C-c' \\`M-g' `magit-file-dispatch' If `recommended', maybe add: - C-x g `magit-status' - C-c g `magit-dispatch' - C-c f `magit-file-dispatch' + \\`C-x' \\`g' `magit-status' + \\`C-c' \\`g' `magit-dispatch' + \\`C-c' \\`f' `magit-file-dispatch' These bindings are strongly recommended, but we cannot use - them by default, because the \"C-c \" namespace is + them by default, because the \\`C-c ' namespace is strictly reserved for bindings added by the user. The bindings in the chosen set may be added when @@ -99,7 +100,7 @@ See variable `magit-define-global-key-bindings'." (when magit-define-global-key- (autoload 'magit-git-command "magit" "\ Execute COMMAND asynchronously; display output. -Interactively, prompt for COMMAND in the minibuffer. \"git \" is +Interactively, prompt for COMMAND in the minibuffer. \"git \" is used as initial input, but can be deleted to run another command. With a prefix argument COMMAND is run in the top-level directory @@ -109,7 +110,7 @@ of the current working tree, otherwise in `default-directory'. (autoload 'magit-git-command-topdir "magit" "\ Execute COMMAND asynchronously; display output. -Interactively, prompt for COMMAND in the minibuffer. \"git \" is +Interactively, prompt for COMMAND in the minibuffer. \"git \" is used as initial input, but can be deleted to run another command. COMMAND is run in the top-level directory of the current @@ -146,9 +147,7 @@ the output in the kill ring. ;;; Generated autoloads from magit-apply.el -(autoload 'magit-stage-buffer-file "magit-apply" "\ -Stage all changes to the file being visited in the current buffer." t) -(autoload 'magit-stage-file "magit-apply" "\ +(autoload 'magit-stage-files "magit-apply" "\ Read one or more files and stage all changes in those files. With prefix argument FORCE, offer ignored files for completion. @@ -161,9 +160,7 @@ With a prefix argument also stage previously untracked (but not ignored) files. (fn &optional ALL)" t) -(autoload 'magit-unstage-buffer-file "magit-apply" "\ -Unstage all changes to the file being visited in the current buffer." t) -(autoload 'magit-unstage-file "magit-apply" "\ +(autoload 'magit-unstage-files "magit-apply" "\ Read one or more files and unstage all changes to those files. (fn FILES)" t) @@ -430,14 +427,15 @@ the remote. (fn OLD NEW &optional FORCE)" t) (autoload 'magit-branch-shelve "magit-branch" "\ Shelve a BRANCH. -Rename \"refs/heads/BRANCH\" to \"refs/shelved/BRANCH\", +Rename \"refs/heads/BRANCH\" to \"refs/shelved/YYYY-MM-DD-BRANCH\", and also rename the respective reflog file. (fn BRANCH)" t) (autoload 'magit-branch-unshelve "magit-branch" "\ -Unshelve a BRANCH -Rename \"refs/shelved/BRANCH\" to \"refs/heads/BRANCH\", -and also rename the respective reflog file. +Unshelve a BRANCH. +Rename \"refs/shelved/BRANCH\" to \"refs/heads/BRANCH\". If BRANCH +is prefixed with \"YYYY-MM-DD\", then drop that part of the name. +Also rename the respective reflog file. (fn BRANCH)" t) (autoload 'magit-branch-configure "magit-branch" nil t) @@ -517,78 +515,132 @@ Clone REPOSITORY into DIRECTORY and create a sparse checkout. (autoload 'magit-commit "magit-commit" nil t) (autoload 'magit-commit-create "magit-commit" "\ -Create a new commit on `HEAD'. -With a prefix argument, amend to the commit at `HEAD' instead. - -(git commit [--amend] ARGS) - -(fn &optional ARGS)" t) -(autoload 'magit-commit-amend "magit-commit" "\ -Amend the last commit. - -(git commit --amend ARGS) +Create a new commit. (fn &optional ARGS)" t) (autoload 'magit-commit-extend "magit-commit" "\ -Amend the last commit, without editing the message. - -With a prefix argument keep the committer date, otherwise change -it. The option `magit-commit-extend-override-date' can be used -to inverse the meaning of the prefix argument. +Amend staged changes to the last commit, without editing its message. -(git commit --amend --no-edit) +With a prefix argument do not update the committer date; without an +argument update it. The option `magit-commit-extend-override-date' +can be used to inverse the meaning of the prefix argument. Called +non-interactively, the optional OVERRIDE-DATE argument controls this +behavior, and the option is of no relevance. (fn &optional ARGS OVERRIDE-DATE)" t) -(autoload 'magit-commit-reword "magit-commit" "\ -Reword the last commit, ignoring staged changes. - -With a prefix argument keep the committer date, otherwise change -it. The option `magit-commit-reword-override-date' can be used -to inverse the meaning of the prefix argument. +(autoload 'magit-commit-amend "magit-commit" "\ +Amend staged changes (if any) to the last commit, and edit its message. -Non-interactively respect the optional OVERRIDE-DATE argument -and ignore the option. +(fn &optional ARGS)" t) +(autoload 'magit-commit-reword "magit-commit" "\ +Reword the message of the last commit, without amending its tree. -(git commit --amend --only) +With a prefix argument do not update the committer date; without an +argument update it. The option `magit-commit-reword-override-date' +can be used to inverse the meaning of the prefix argument. Called +non-interactively, the optional OVERRIDE-DATE argument controls this +behavior, and the option is of no relevance. (fn &optional ARGS OVERRIDE-DATE)" t) (autoload 'magit-commit-fixup "magit-commit" "\ -Create a fixup commit. +Create a fixup commit, leaving the original commit message untouched. + +If there is a reachable commit at point, target that. Otherwise prompt +for a commit. If `magit-commit-squash-confirm' is non-nil, always make +the user explicitly select a commit, in a buffer dedicated to that task. + +During a later rebase, when this commit gets squashed into its targeted +commit, the original message of the targeted commit is used as-is. -With a prefix argument the target COMMIT has to be confirmed. -Otherwise the commit at point may be used without confirmation -depending on the value of option `magit-commit-squash-confirm'. +In other words, call \"git commit --fixup=COMMIT --no-edit\". (fn &optional COMMIT ARGS)" t) (autoload 'magit-commit-squash "magit-commit" "\ -Create a squash commit, without editing the squash message. +Create a squash commit, without the user authoring a commit message. + +If there is a reachable commit at point, target that. Otherwise prompt +for a commit. If `magit-commit-squash-confirm' is non-nil, always make +the user explicitly select a commit, in a buffer dedicated to that task. + +During a later rebase, when this commit gets squashed into its targeted +commit, the user is given a chance to edit the original message to take +the changes from the squash commit into account. + +In other words, call \"git commit --squash=COMMIT --no-edit\". + +(fn &optional COMMIT ARGS)" t) +(autoload 'magit-commit-alter "magit-commit" "\ +Create a squash commit, authoring the final commit message now. -With a prefix argument the target COMMIT has to be confirmed. -Otherwise the commit at point may be used without confirmation -depending on the value of option `magit-commit-squash-confirm'. +If there is a reachable commit at point, target that. Otherwise prompt +for a commit. If `magit-commit-squash-confirm' is non-nil, always make +the user explicitly select a commit, in a buffer dedicated to that task. -If you want to immediately add a message to the squash commit, -then use `magit-commit-augment' instead of this command. +During a later rebase, when this commit gets squashed into its targeted +commit, the original message of the targeted commit is replaced with the +message of this commit, without the user automatically being given a +chance to edit again. + +In other words, call \"git commit --fixup=amend:COMMIT --edit\". (fn &optional COMMIT ARGS)" t) (autoload 'magit-commit-augment "magit-commit" "\ -Create a squash commit, editing the squash message. +Create a squash commit, authoring a new temporary commit message. + +If there is a reachable commit at point, target that. Otherwise prompt +for a commit. If `magit-commit-squash-confirm' is non-nil, always make +the user explicitly select a commit, in a buffer dedicated to that task. + +During a later rebase, when this commit gets squashed into its targeted +commit, the user is asked to write a final commit message, in a buffer +that starts out containing both the original commit message, as well as +the temporary commit message of the squash commit. -With a prefix argument the target COMMIT has to be confirmed. -Otherwise the commit at point may be used without confirmation -depending on the value of option `magit-commit-squash-confirm'. +In other words, call \"git commit --squash=COMMIT --edit\". + +(fn &optional COMMIT ARGS)" t) +(autoload 'magit-commit-revise "magit-commit" "\ +Reword the message of an existing commit, without editing its tree. + +If there is a reachable commit at point, target that. Otherwise prompt +for a commit. If `magit-commit-squash-confirm' is non-nil, always make +the user explicitly select a commit, in a buffer dedicated to that task. + +During a later rebase, when this commit gets squashed into its targeted +commit, a combined commit is created which uses the message of the fixup +commit and the tree of the targeted commit. + +In other words, call \"git commit --fixup=reword:COMMIT --edit\". (fn &optional COMMIT ARGS)" t) (autoload 'magit-commit-instant-fixup "magit-commit" "\ -Create a fixup commit targeting COMMIT and instantly rebase. +Create a fixup commit, and immediately combine it with its target. + +If there is a reachable commit at point, target that. Otherwise prompt +for a commit. If `magit-commit-squash-confirm' is non-nil, always make +the user explicitly select a commit, in a buffer dedicated to that task. + +Leave the original commit message of the targeted commit untouched. + +Like `magit-commit-fixup' but also run a `--autofixup' rebase. (fn &optional COMMIT ARGS)" t) (autoload 'magit-commit-instant-squash "magit-commit" "\ -Create a squash commit targeting COMMIT and instantly rebase. +Create a squash commit, and immediately combine it with its target. + +If there is a reachable commit at point, target that. Otherwise prompt +for a commit. If `magit-commit-squash-confirm' is non-nil, always make +the user explicitly select a commit, in a buffer dedicated to that task. + +Turing the rebase phase, when the two commits are being squashed, ask +the user to author the final commit message, based on the original +message of the targeted commit. + +Like `magit-commit-squash' but also run a `--autofixup' rebase. (fn &optional COMMIT ARGS)" t) (autoload 'magit-commit-reshelve "magit-commit" "\ -Change the committer date and possibly the author date of `HEAD'. +Change committer (and possibly author) date of the last commit. The current time is used as the initial minibuffer input and the original author or committer date is available as the previous @@ -696,6 +748,35 @@ for a revision. (fn REV &optional ARGS FILES MODULE)" t) (register-definition-prefixes "magit-diff" '("magit-")) + +;;; Generated autoloads from magit-dired.el + +(autoload 'magit-dired-jump "magit-dired" "\ +Visit file at point using Dired. +With a prefix argument, visit in another window. If there +is no file at point, then instead visit `default-directory'. + +(fn &optional OTHER-WINDOW)" t) +(autoload 'magit-dired-stage "magit-dired" "\ +In Dired, staged all marked files or the file at point." t) +(autoload 'magit-dired-unstage "magit-dired" "\ +In Dired, unstaged all marked files or the file at point." t) +(autoload 'magit-dired-log "magit-dired" "\ +In Dired, show log for all marked files or the directory if none are marked. + +(fn &optional FOLLOW)" t) +(autoload 'magit-dired-am-apply-patches "magit-dired" "\ +In Dired, apply the marked (or next ARG) files as patches. +If inside a repository, then apply in that. Otherwise prompt +for a repository. + +(fn REPO &optional ARG)" t) +(autoload 'magit-do-async-shell-command "magit-dired" "\ +Open FILE with `dired-do-async-shell-command'. +Interactively, open the file at point. + +(fn FILE)" t) + ;;; Generated autoloads from magit-ediff.el @@ -804,36 +885,8 @@ Run `gitk' in the current repository." t) Run `gitk --branches' in the current repository." t) (autoload 'magit-run-gitk-all "magit-extras" "\ Run `gitk --all' in the current repository." t) -(autoload 'ido-enter-magit-status "magit-extras" "\ -Drop into `magit-status' from file switching. - -To make this command available use something like: - - (keymap-set ido-common-completion-map - \"C-x g\" \\='ido-enter-magit-status)" t) (autoload 'magit-project-status "magit-extras" "\ Run `magit-status' in the current project's root." t) -(autoload 'magit-dired-jump "magit-extras" "\ -Visit file at point using Dired. -With a prefix argument, visit in another window. If there -is no file at point, then instead visit `default-directory'. - -(fn &optional OTHER-WINDOW)" t) -(autoload 'magit-dired-log "magit-extras" "\ -Show log for all marked files, or the current file. - -(fn &optional FOLLOW)" t) -(autoload 'magit-dired-am-apply-patches "magit-extras" "\ -In Dired, apply the marked (or next ARG) files as patches. -If inside a repository, then apply in that. Otherwise prompt -for a repository. - -(fn REPO &optional ARG)" t) -(autoload 'magit-do-async-shell-command "magit-extras" "\ -Open FILE with `dired-do-async-shell-command'. -Interactively, open the file at point. - -(fn FILE)" t) (autoload 'magit-previous-line "magit-extras" "\ Like `previous-line' but with Magit-specific shift-selection. @@ -1099,6 +1152,31 @@ the line and column corresponding to that location. View the file from the worktree corresponding to the current blob. When visiting a blob or the version from the index, then go to the same location in the respective file in the working tree." t) +(autoload 'magit-file-stage "magit-files" "\ +Stage all changes to the file being visited in the current buffer." t) +(autoload 'magit-file-unstage "magit-files" "\ +Unstage all changes to the file being visited in the current buffer." t) +(autoload 'magit-file-untrack "magit-files" "\ +Untrack the selected FILES or one file read in the minibuffer. + +With a prefix argument FORCE do so even when the files have +staged as well as unstaged changes. + +(fn FILES &optional FORCE)" t) +(autoload 'magit-file-rename "magit-files" "\ +Rename or move FILE to NEWNAME. +NEWNAME may be a file or directory name. If FILE isn't tracked in +Git, fallback to using `rename-file'. + +(fn FILE NEWNAME)" t) +(autoload 'magit-file-delete "magit-files" "\ +Delete the selected FILES or one file read in the minibuffer. + +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'. + +(fn FILES &optional FORCE)" t) (autoload 'magit-file-checkout "magit-files" "\ Checkout FILE from REV. @@ -1161,12 +1239,7 @@ Call \"git update-index --no-assume-unchanged -- FILE\". (autoload 'magit-log "magit-log" nil t) (autoload 'magit-log-refresh "magit-log" nil t) -(autoload 'magit-log-current "magit-log" "\ -Show log for the current branch. -When `HEAD' is detached or with a prefix argument show log for -one or more revs read from the minibuffer. - -(fn REVS &optional ARGS FILES)" t) + (autoload 'magit-log-current "magit-log" nil t) (autoload 'magit-log-head "magit-log" "\ Show log for `HEAD'. @@ -1285,7 +1358,7 @@ inspect the merge and change the commit message. (git merge --no-commit --no-ff [ARGS] REV) (fn REV &optional ARGS)" t) -(autoload 'magit-merge-into "magit-merge" "\ +(autoload 'magit-merge-dissolve "magit-merge" "\ Merge the current branch into BRANCH and remove the former. Before merging, force push the source branch to its push-remote, @@ -1701,8 +1774,11 @@ Start an interactive rebase sequence. (fn COMMIT ARGS)" t) (autoload 'magit-rebase-autosquash "magit-sequence" "\ Combine squash and fixup commits with their intended targets. +By default only squash into commits that are not reachable from +the upstream branch. If no upstream is configured or with a prefix +argument, prompt for the first commit to potentially squash into. -(fn ARGS)" t) +(fn SELECT ARGS)" t) (autoload 'magit-rebase-edit-commit "magit-sequence" "\ Edit a single older commit using rebase. @@ -1876,7 +1952,7 @@ Then apply STASH, dropping it if it applies cleanly. (fn STASH BRANCH)" t) (autoload 'magit-stash-format-patch "magit-stash" "\ -Create a patch from STASH +Create a patch from STASH. (fn STASH)" t) (autoload 'magit-stash-list "magit-stash" "\ diff --git a/elpa/magit-20250107.2324/magit-autorevert.el b/elpa/magit-20250519.1537/magit-autorevert.el similarity index 96% rename from elpa/magit-20250107.2324/magit-autorevert.el rename to elpa/magit-20250519.1537/magit-autorevert.el index f3403027..3579bf2e 100644 --- a/elpa/magit-20250107.2324/magit-autorevert.el +++ b/elpa/magit-20250519.1537/magit-autorevert.el @@ -20,6 +20,13 @@ ;; You should have received a copy of the GNU General Public License ;; along with Magit. If not, see . +;;; Commentary: + +;; This library implements support for automatically reverting buffers +;; when visited files in the repository change. + +;; See (info "(magit)Automatic Reverting of File-Visiting Buffers"). + ;;; Code: (require 'magit-process) @@ -58,9 +65,9 @@ is enabled." :group 'auto-revert :group 'magit-auto-revert :group 'magit-related - :type '(radio (const :tag "No filter" nil) - (function-item magit-auto-revert-buffer-p) - (function-item magit-auto-revert-repository-buffer-p) + :type `(radio (const :tag "No filter" nil) + (function-item ,#'magit-auto-revert-buffer-p) + (function-item ,#'magit-auto-revert-repository-buffer-p) function)) (defcustom magit-auto-revert-tracked-only t diff --git a/elpa/magit-20250107.2324/magit-base.el b/elpa/magit-20250519.1537/magit-base.el similarity index 92% rename from elpa/magit-20250107.2324/magit-base.el rename to elpa/magit-20250519.1537/magit-base.el index 393d3e10..40245465 100644 --- a/elpa/magit-20250107.2324/magit-base.el +++ b/elpa/magit-20250519.1537/magit-base.el @@ -32,13 +32,14 @@ ;;; Code: -(defconst magit--minimal-git "2.25.0") +;; Also update EMACS_VERSION in "default.mk". (defconst magit--minimal-emacs "27.1") +(defconst magit--minimal-git "2.25.0") (require 'cl-lib) (require 'compat) -(require 'dash) (require 'eieio) +(require 'llama) (require 'subr-x) ;; For older Emacs releases we depend on an updated `seq' release from @@ -68,26 +69,23 @@ (defcustom magit-completing-read-function #'magit-builtin-completing-read "Function to be called when requesting input from the user. -If you have enabled `ivy-mode' or `helm-mode', then you don't -have to customize this option; `magit-builtin-completing-read' -will work just fine. However, if you use Ido completion, then -you do have to use `magit-ido-completing-read', because Ido is -less well behaved than the former, more modern alternatives. - -If you would like to use Ivy or Helm completion with Magit but -not enable the respective modes globally, then customize this -option to use `ivy-completing-read' or -`helm--completing-read-default'. If you choose to use -`ivy-completing-read', note that the items may always be shown in -alphabetical order, depending on your version of Ivy." +The default, `magit-builtin-completing-read', support third-party +completion frameworks, including `vertico-mode', `ivy-mode' and +`helm-mode'. + +However, if you would like to use Ivy or Helm completion with Magit but +not enable the respective modes globally, then customize this option to +use `ivy-completing-read' or `helm--completing-read-default'. + +If you still use `ido-mode', you'll likely need the `magit-ido' package." :group 'magit-essentials - :type '(radio (function-item magit-builtin-completing-read) - (function-item magit-ido-completing-read) + :type `(radio (function-item ,#'magit-builtin-completing-read) (function-item ivy-completing-read) (function-item helm--completing-read-default) (function :tag "Other function"))) (defcustom magit-dwim-selection + ;; Do not function-quote to avoid circular dependencies. '((magit-stash-apply nil t) (magit-ediff-resolve-all nil t) (magit-ediff-resolve-rest nil t) @@ -127,11 +125,11 @@ The value has the form ((COMMAND nil|PROMPT DEFAULT)...). :group 'magit-commands :type '(repeat (list (symbol :tag "Command") ; It might not be fboundp yet. - (choice (const :tag "for all prompts" nil) - (regexp :tag "for prompts matching regexp")) - (choice (const :tag "offer other choices" nil) - (const :tag "require confirmation" ask) - (const :tag "use default without confirmation" t))))) + (choice (const :tag "For all prompts" nil) + (regexp :tag "For prompts matching regexp")) + (choice (const :tag "Offer other choices" nil) + (const :tag "Require confirmation" ask) + (const :tag "Use default without confirmation" t))))) (defconst magit--confirm-actions '((const discard) @@ -465,9 +463,9 @@ and delay of your graphical environment or operating system." `woman' View the respective man-page using the `woman' package." :package-version '(magit . "2.9.0") :group 'magit-miscellaneous - :type '(choice (const :tag "view info manual" info) - (const :tag "view manpage using `man'" man) - (const :tag "view manpage using `woman'" woman))) + :type '(choice (const :tag "View info manual" info) + (const :tag "View manpage using `man'" man) + (const :tag "View manpage using `woman'" woman))) ;;; Section Classes @@ -484,7 +482,9 @@ and delay of your graphical environment or operating system." ((keymap :initform 'magit-file-section-map) (source :initform nil :initarg :source) (header :initform nil :initarg :header) - (binary :initform nil :initarg :binary))) + (binary :initform nil :initarg :binary) + (heading-highlight-face :initform 'magit-diff-file-heading-highlight) + (heading-selection-face :initform 'magit-diff-file-heading-selection))) (defclass magit-module-section (magit-file-section) ((keymap :initform 'magit-module-section-map) @@ -492,12 +492,15 @@ and delay of your graphical environment or operating system." (defclass magit-hunk-section (magit-diff-section) ((keymap :initform 'magit-hunk-section-map) + (painted :initform nil) (refined :initform nil) (combined :initform nil :initarg :combined) (from-range :initform nil :initarg :from-range) (from-ranges :initform nil) (to-range :initform nil :initarg :to-range) - (about :initform nil :initarg :about))) + (about :initform nil :initarg :about) + (heading-highlight-face :initform 'magit-diff-hunk-heading-highlight) + (heading-selection-face :initform 'magit-diff-hunk-heading-selection))) (setf (alist-get 'file magit--section-type-alist) 'magit-file-section) (setf (alist-get 'module magit--section-type-alist) 'magit-module-section) @@ -602,21 +605,21 @@ acts similarly to `completing-read', except for the following: def) (unless def (setq def fallback)) + (when (and def + (not (functionp collection)) + (not (member def collection))) + (setq collection (cons def collection))) (let ((command this-command) - (reply (funcall - magit-completing-read-function - (magit--format-prompt prompt def) - (if (and (not (functionp collection)) - def - (not (member def collection))) - (cons def collection) - collection) - predicate - require-match initial-input hist def))) + (reply (funcall magit-completing-read-function + (magit--format-prompt prompt def) + collection predicate + require-match initial-input hist def))) (setq this-command command) ;; Note: Avoid `string=' to support `helm-comp-read-use-marked'. (if (equal reply "") - (if require-match + (if (and require-match + (not (and (listp collection) + (member "" collection)))) (user-error "Nothing selected") nil) reply)))) @@ -640,9 +643,13 @@ acts similarly to `completing-read', except for the following: (unless (or (bound-and-true-p helm-mode) (bound-and-true-p ivy-mode)) (setq choices (magit--completion-table choices))) - (let ((ivy-sort-functions-alist nil) - (vertico-sort-function nil)) - (completing-read prompt choices + (let ((ivy-sort-functions-alist nil)) + (completing-read prompt + (lambda (str pred action) + (if (eq action 'metadata) + '(metadata (display-sort-function . identity) + (cycle-sort-function . identity)) + (complete-with-action action choices str pred))) predicate require-match initial-input hist def))) @@ -693,27 +700,6 @@ third-party completion frameworks." hist def inherit-input-method))) (if no-split input values))) -(defun magit-ido-completing-read - (prompt choices &optional predicate require-match initial-input hist def) - "Ido-based `completing-read' almost-replacement. - -Unfortunately `ido-completing-read' is not suitable as a -drop-in replacement for `completing-read', instead we use -`ido-completing-read+' from the third-party package by the -same name." - (if (and (require 'ido-completing-read+ nil t) - (fboundp 'ido-completing-read+)) - (ido-completing-read+ prompt choices predicate require-match - initial-input hist - (or def (and require-match (car choices)))) - (display-warning 'magit "ido-completing-read+ is not installed - -To use Ido completion with Magit you need to install the -third-party `ido-completing-read+' packages. Falling -back to built-in `completing-read' for now." :error) - (magit-builtin-completing-read prompt choices predicate require-match - initial-input hist def))) - (defvar-keymap magit-minibuffer-local-ns-map :parent minibuffer-local-map "SPC" #'magit-whitespace-disallowed @@ -780,7 +766,7 @@ This is similar to `read-string', but (string-join (butlast parts) ", ") ", or " (car (last parts)) " ")) ',(mapcar #'car clauses)) - ,@(--map `(,(car it) ,@(cddr it)) clauses)) + ,@(mapcar (##`(,(car %) ,@(cddr %))) clauses)) (message ""))) (defun magit-y-or-n-p (prompt &optional action) @@ -802,12 +788,12 @@ ACTION is a member of option `magit-slow-confirm'." (when (and prompt (listp prompt)) (setq prompt (apply #'format (car prompt) - (mapcar (lambda (a) (if (stringp a) (string-replace "%" "%%" a) a)) + (mapcar (##if (stringp %) (string-replace "%" "%%" %) %) (cdr prompt))))) (when (and prompt-n (listp prompt-n)) (setq prompt-n (apply #'format (car prompt-n) - (mapcar (lambda (a) (if (stringp a) (string-replace "%" "%%" a) a)) + (mapcar (##if (stringp %) (string-replace "%" "%%" %) %) (cdr prompt-n))))) (setq prompt-n (format (concat (or prompt-n prompt) "? ") (length items))) (setq prompt (format (concat (or prompt (magit-confirm-make-prompt action)) @@ -872,7 +858,7 @@ See info node `(magit)Debugging Tools' for more information." `(,(concat invocation-directory invocation-name) "-Q" "--eval" "(setq debug-on-error t)" ,@(mapcan - (lambda (dir) (list "-L" dir)) + (##list "-L" %) (delete-dups (mapcan (lambda (lib) @@ -881,16 +867,15 @@ See info node `(magit)Debugging Tools' for more information." (error "Cannot find mandatory dependency %s" lib))) '(;; Like `LOAD_PATH' in `default.mk'. "compat" - "dash" + "llama" + "seq" "transient" "with-editor" ;; Obviously `magit' itself is needed too. "magit" - ;; While these are part of the Magit repository, - ;; they are distributed as separate packages. - "magit-section" - "git-commit" - )))) + ;; While this is part of the Magit repository, + ;; it is distributed as a separate package. + "magit-section")))) ;; Avoid Emacs bug#16406 by using full path. "-l" ,(file-name-sans-extension (locate-library "magit"))) " "))) @@ -907,7 +892,7 @@ data, starting with 1 and incrementing by 1 for each symbol. If the last match was against a string, then that has to be provided as STRING." (declare (indent 2) (debug (listp form body))) - (let ((s (cl-gensym "string")) + (let ((s (gensym "string")) (i 0)) `(let ((,s ,string)) (let ,(save-match-data @@ -1019,6 +1004,16 @@ one trailing newline is added." (and (eq trim ?\n) "\n")) str))) +(defun magit--separate (pred list) + "Separate elements of LIST that do and don't satisfy PRED. +Return a list of two lists; the first containing the elements that +do satisfy PRED and the second containing the elements that don't." + (let (y n) + (dolist (elt list) + (push elt (if (funcall pred elt) y n))) + (list (nreverse y) + (nreverse n)))) + (defun magit--version> (v1 v2) "Return t if version V1 is higher (younger) than V2. This function should be named `version>' and be part of Emacs." @@ -1032,7 +1027,7 @@ This function should be named `version>=' and be part of Emacs." ;;; Kludges for Emacs Bugs (defun magit-which-function () - "Return current function name based on point. + "Return current function name based on point, without caching. This is a simple wrapper around `which-function', that resets Imenu's potentially outdated and therefore unreliable cache by @@ -1157,7 +1152,7 @@ See ." Like `message', except that if the users configured option `magit-no-message' to prevent the message corresponding to FORMAT-STRING to be displayed, then don't." - (unless (--first (string-prefix-p it format-string) magit-no-message) + (unless (seq-find (##string-prefix-p % format-string) magit-no-message) (apply #'message format-string args))) (defun magit-msg (format-string &rest args) @@ -1191,15 +1186,14 @@ Like `message', except that `message-log-max' is bound to nil." ellipsis))) (user-error "Variable magit-ellipsis is invalid")))) -(defun magit--ext-regexp-quote (str) +(defun magit--ext-regexp-quote (string) "Like `reqexp-quote', but for Extended Regular Expressions." (let ((special (string-to-list "[*.\\?+^$({")) (quoted nil)) - (mapc (lambda (c) - (when (memq c special) - (push ?\\ quoted)) - (push c quoted)) - str) + (dolist (char string) + (when (memq char special) + (push ?\\ quoted)) + (push char quoted)) (concat (nreverse quoted)))) ;;; _ diff --git a/elpa/magit-20250107.2324/magit-bisect.el b/elpa/magit-20250519.1537/magit-bisect.el similarity index 97% rename from elpa/magit-20250107.2324/magit-bisect.el rename to elpa/magit-20250519.1537/magit-bisect.el index 475d2575..8c737c13 100644 --- a/elpa/magit-20250107.2324/magit-bisect.el +++ b/elpa/magit-20250519.1537/magit-bisect.el @@ -62,7 +62,7 @@ ["Arguments" ("-n" "Don't checkout commits" "--no-checkout") ("-p" "Follow only first parent of a merge" "--first-parent" - :if (lambda () (magit-git-version>= "2.29"))) + :if (##magit-git-version>= "2.29")) (magit-bisect:--term-old :level 6) (magit-bisect:--term-new :level 6)] ["Actions" @@ -256,7 +256,7 @@ bisect run'." (done-re "^\\([a-z0-9]\\{40,\\}\\) is the first bad commit$") (bad-line (or (and (string-match done-re (car lines)) (pop lines)) - (--first (string-match done-re it) lines)))) + (seq-find (##string-match done-re %) lines)))) (magit-insert-section ((eval (if bad-line 'commit 'bisect-output)) (and bad-line (match-string 1 bad-line))) (magit-insert-heading @@ -299,9 +299,9 @@ bisect run'." (narrow-to-region beg (point)) (goto-char (point-min)) (magit-insert-section (bisect-item heading t) - (insert (propertize heading 'font-lock-face - 'magit-section-secondary-heading)) - (magit-insert-heading) + (magit-insert-heading + (propertize heading 'font-lock-face + 'magit-section-secondary-heading)) (magit-wash-sequence (apply-partially #'magit-log-wash-rev 'bisect-log (magit-abbrev-length))) diff --git a/elpa/magit-20250107.2324/magit-blame.el b/elpa/magit-20250519.1537/magit-blame.el similarity index 96% rename from elpa/magit-20250107.2324/magit-blame.el rename to elpa/magit-20250519.1537/magit-blame.el index 1e8f0ba5..e87bd4fc 100644 --- a/elpa/magit-20250107.2324/magit-blame.el +++ b/elpa/magit-20250519.1537/magit-blame.el @@ -94,12 +94,17 @@ The following %-specs can be used in `heading-format' and `margin-format': %H hash using face `magit-blame-hash' + %h truncated hash using face `magit-blame-hash' %s summary using face `magit-blame-summary' %a author using face `magit-blame-name' %A author time using face `magit-blame-date' %c committer using face `magit-blame-name' %C committer time using face `magit-blame-date' +Note that for performance reasons %h results in truncated +hashes, as opposed to properly abbreviated hashes that are +guaranteed to uniquely identify a commit. + Additionally if `margin-format' ends with %f, then the string that is displayed in the margin is made at least `margin-width' characters wide, which may be desirable if the used face sets @@ -107,7 +112,7 @@ the background color. Blame information is displayed using overlays. Such extensive use of overlays is known to slow down even basic operations, such -as moving the cursor. To reduce the number of overlays the margin +as moving the cursor. To reduce the number of overlays the margin style had to be removed from the default value of this option. Note that the margin overlays are created even if another style @@ -277,15 +282,15 @@ Also see option `magit-blame-styles'." ((error "Buffer does not visit a tracked file"))))))) (defun magit-blame-chunk-at (pos) - (--some (overlay-get it 'magit-blame-chunk) - (overlays-at pos))) + (seq-some (##overlay-get % 'magit-blame-chunk) + (overlays-at pos))) (defun magit-blame--overlay-at (&optional pos key) (unless pos (setq pos (point))) - (--first (overlay-get it (or key 'magit-blame-chunk)) - (nconc (overlays-at pos) - (overlays-in pos pos)))) + (seq-find (##overlay-get % (or key 'magit-blame-chunk)) + (nconc (overlays-at pos) + (overlays-in pos pos)))) ;;; Keymaps @@ -343,8 +348,7 @@ in `magit-blame-read-only-mode-map' instead." (unless magit-blame--style (setq magit-blame--style (car magit-blame-styles))) (setq magit-blame--make-margin-overlays - (and (cl-find-if (lambda (style) - (assq 'margin-format (cdr style))) + (and (cl-find-if (##assq 'margin-format (cdr %)) magit-blame-styles))) (magit-blame--update-margin 'enable)) (t @@ -702,6 +706,7 @@ modes is toggled, then this mode also gets toggled automatically. (cdr (assoc k2 revinfo))) f))) `((?H . ,(p0 rev 'magit-blame-hash)) + (?h . ,(p0 (magit-blame--abbrev-hash rev) 'magit-blame-hash)) (?s . ,(p1 "summary" 'magit-blame-summary)) (?a . ,(p1 "author" 'magit-blame-name)) (?c . ,(p1 "committer" 'magit-blame-name)) @@ -732,6 +737,13 @@ modes is toggled, then this mode also gets toggled automatically. (seconds-to-time (string-to-number time)) tz-in-second))) +(defvar-local magit-blame--abbrev-length nil) + +(defun magit-blame--abbrev-hash (rev) + (substring rev 0 (or magit-blame--abbrev-length + (setq magit-blame--abbrev-length + (magit-abbrev-length))))) + (defun magit-blame--remove-overlays (&optional beg end) (save-restriction (widen) @@ -742,14 +754,13 @@ modes is toggled, then this mode also gets toggled automatically. (defun magit-blame-maybe-show-message () (when (magit-blame--style-get 'show-message) - (let ((message-log-max 0)) - (if-let ((msg (cdr (assoc "summary" - (gethash (oref (magit-current-blame-chunk) - orig-rev) - magit-blame-cache))))) - (progn (set-text-properties 0 (length msg) nil msg) - (message msg)) - (message "Commit data not available yet. Still blaming."))))) + (if-let ((msg (cdr (assoc "summary" + (gethash (oref (magit-current-blame-chunk) + orig-rev) + magit-blame-cache))))) + (progn (set-text-properties 0 (length msg) nil msg) + (magit-msg "%S" msg)) + (magit-msg "Commit data not available yet. Still blaming.")))) ;;; Commands @@ -759,10 +770,9 @@ modes is toggled, then this mode also gets toggled automatically. Show the information about the chunk at point in the echo area when moving between chunks. Unlike other blaming commands, do not turn on `read-only-mode'." - :if (lambda () - (and buffer-file-name + :if (##and buffer-file-name (or (not magit-blame-mode) - buffer-read-only))) + buffer-read-only)) (interactive (list (magit-blame-arguments))) (when magit-buffer-file-name (user-error "Blob buffers aren't supported")) @@ -816,7 +826,7 @@ not turn on `read-only-mode'." (if-let ((chunk (magit-current-blame-chunk))) (unless (oref chunk prev-rev) (user-error "Chunk has no further history")) - (user-error "Commit data not available yet. Still blaming.")) + (user-error "Still blaming, commit data not available yet")) (unless (magit-file-relative-name nil (not magit-buffer-file-name)) (if buffer-file-name (user-error "Buffer isn't visiting a tracked file") @@ -884,7 +894,8 @@ then also kill the buffer." (user-error "No more chunks"))) (defun magit-blame-next-chunk-same-commit (&optional previous) - "Move to the next chunk from the same commit.\n\n(fn)" + "Move to the next chunk from the same commit. +\n(fn)" (interactive) (if-let ((rev (oref (magit-current-blame-chunk) orig-rev))) (let ((pos (point)) ov) diff --git a/elpa/magit-20250107.2324/magit-bookmark.el b/elpa/magit-20250519.1537/magit-bookmark.el similarity index 97% rename from elpa/magit-20250107.2324/magit-bookmark.el rename to elpa/magit-20250519.1537/magit-bookmark.el index 061ef293..963b7e1c 100644 --- a/elpa/magit-20250107.2324/magit-bookmark.el +++ b/elpa/magit-20250519.1537/magit-bookmark.el @@ -44,8 +44,8 @@ (magit-display-buffer-noselect t)) (apply (intern (format "%s-setup-buffer" (substring (symbol-name mode) 0 -5))) - (--map (bookmark-prop-get bookmark it) - (get mode 'magit-bookmark-variables))))) + (mapcar (##bookmark-prop-get bookmark %) + (get mode 'magit-bookmark-variables))))) ;;; Diff ;;;; Diff diff --git a/elpa/magit-20250107.2324/magit-branch.el b/elpa/magit-20250519.1537/magit-branch.el similarity index 94% rename from elpa/magit-20250107.2324/magit-branch.el rename to elpa/magit-20250519.1537/magit-branch.el index fb3cc9a7..56a754e5 100644 --- a/elpa/magit-20250107.2324/magit-branch.el +++ b/elpa/magit-20250519.1537/magit-branch.el @@ -46,9 +46,9 @@ new branch and continue by reading the upstream next." :package-version '(magit . "2.2.0") :group 'magit-commands - :type '(choice (const :tag "read branch name first" nil) - (const :tag "read upstream first" t) - (const :tag "read upstream first, with fallback" fallback))) + :type '(choice (const :tag "Read branch name first" nil) + (const :tag "Read upstream first" t) + (const :tag "Read upstream first, with fallback" fallback))) (defcustom magit-branch-prefer-remote-upstream nil "Whether to favor remote upstreams when creating new branches. @@ -154,10 +154,10 @@ However, I recommend that you use local branches as UPSTREAM." :package-version '(magit . "2.9.0") :group 'magit-commands :type '(repeat (cons (string :tag "Use upstream") - (choice :tag "for branches" - (regexp :tag "matching") - (repeat :tag "except" - (string :tag "branch")))))) + (choice :tag "For branches" ;??? + (regexp :tag "Matching") + (repeat :tag "Except" + (string :tag "Branch")))))) (defcustom magit-branch-rename-push-target t "Whether the push-remote setup is preserved when renaming a branch. @@ -208,11 +208,10 @@ has to be used to view and change branch related variables." (transient-define-prefix magit-branch (branch) "Add, configure or remove a branch." :man-page "git-branch" - [:if (lambda () (and magit-branch-direct-configure (transient-scope))) - :description - (lambda () - (concat (propertize "Configure " 'face 'transient-heading) - (propertize (transient-scope) 'face 'magit-branch-local))) + [:if (##and magit-branch-direct-configure (transient-scope)) + :description (##concat + (propertize "Configure " 'face 'transient-heading) + (propertize (transient-scope) 'face 'magit-branch-local)) ("d" magit-branch..description) ("u" magit-branch..merge/remote) ("r" magit-branch..rebase) @@ -355,10 +354,10 @@ when using `magit-branch-and-checkout'." (interactive (let* ((current (magit-get-current-branch)) (local (magit-list-local-branch-names)) - (remote (--filter (and (string-match "[^/]+/" it) - (not (member (substring it (match-end 0)) - (cons "HEAD" local)))) - (magit-list-remote-branch-names))) + (remote (seq-filter (##and (string-match "[^/]+/" %) + (not (member (substring % (match-end 0)) + (cons "HEAD" local)))) + (magit-list-remote-branch-names))) (choices (nconc (delete current local) remote)) (atpoint (magit-branch-at-point)) (choice (magit-completing-read @@ -608,9 +607,11 @@ prompt is confusing." (user-error "Abort")))) (list branches force))) (let ((refs (mapcar #'magit-ref-fullname branches))) - (when-let ((ambiguous (--remove it refs))) + ;; If a member of refs is nil, that means that + ;; the respective branch name is ambiguous. + (when-let ((ambiguous (seq-filter #'null refs))) (user-error - "%s ambiguous. Please cleanup using git directly." + "%s ambiguous; please cleanup using git directly" (let ((len (length ambiguous))) (cond ((= len 1) @@ -642,7 +643,7 @@ prompt is confusing." "push" (and (or force magit-branch-delete-never-verify) "--no-verify") remote - (--map (concat ":" (substring it offset)) branches)) + (mapcar (##concat ":" (substring % offset)) branches)) ;; If that is not the case, then this deletes the tracking branches. (set-process-sentinel magit-this-process @@ -729,11 +730,11 @@ prompt is confusing." (defun magit-delete-remote-branch-sentinel (remote refs process event) (when (memq (process-status process) '(exit signal)) (if (= (process-exit-status process) 1) - (if-let ((on-remote (--map (concat "refs/remotes/" remote "/" it) - (magit-remote-list-branches remote))) - (rest (--filter (and (not (member it on-remote)) - (magit-ref-exists-p it)) - refs))) + (if-let ((on-remote (mapcar (##concat "refs/remotes/" remote "/" %) + (magit-remote-list-branches remote))) + (rest (seq-filter (##and (not (member % on-remote)) + (magit-ref-exists-p %)) + refs))) (progn (process-put process 'inhibit-refresh t) (magit-process-sentinel process event) @@ -794,7 +795,7 @@ the remote." (remote (magit-get-push-remote new))) (when (and old-target (not new-target) - (magit-y-or-n-p (format "Also rename %S to %S on \"%s\"" + (magit-y-or-n-p (format "Also rename %S to %S on \"%s\"?" old new remote))) ;; Rename on (i.e., within) the remote, but only if the ;; destination ref doesn't exist yet. If that ref already @@ -811,11 +812,13 @@ the remote." ;;;###autoload (defun magit-branch-shelve (branch) "Shelve a BRANCH. -Rename \"refs/heads/BRANCH\" to \"refs/shelved/BRANCH\", +Rename \"refs/heads/BRANCH\" to \"refs/shelved/YYYY-MM-DD-BRANCH\", and also rename the respective reflog file." (interactive (list (magit-read-other-local-branch "Shelve branch"))) - (let ((old (concat "refs/heads/" branch)) - (new (concat "refs/shelved/" branch))) + (let ((old (concat "refs/heads/" branch)) + (new (format "refs/shelved/%s-%s" + (magit-rev-format "%cs" branch) + branch))) (magit-git "update-ref" new old "") (magit--rename-reflog-file old new) (magit-branch-unset-pushRemote branch) @@ -823,17 +826,22 @@ and also rename the respective reflog file." ;;;###autoload (defun magit-branch-unshelve (branch) - "Unshelve a BRANCH -Rename \"refs/shelved/BRANCH\" to \"refs/heads/BRANCH\", -and also rename the respective reflog file." + "Unshelve a BRANCH. +Rename \"refs/shelved/BRANCH\" to \"refs/heads/BRANCH\". If BRANCH +is prefixed with \"YYYY-MM-DD\", then drop that part of the name. +Also rename the respective reflog file." (interactive (list (magit-completing-read "Unshelve branch" - (--map (substring it 8) - (magit-list-refnames "refs/shelved")) + (mapcar (##substring % 8) + (nreverse (magit-list-refnames "refs/shelved"))) nil t))) (let ((old (concat "refs/shelved/" branch)) - (new (concat "refs/heads/" branch))) + (new (concat "refs/heads/" + (if (string-match-p + "\\`[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}-" branch) + (substring branch 11) + branch)))) (magit-git "update-ref" new old "") (magit--rename-reflog-file old new) (magit-run-git "update-ref" "-d" old))) @@ -852,10 +860,9 @@ and also rename the respective reflog file." (transient-define-prefix magit-branch-configure (branch) "Configure a branch." :man-page "git-branch" - [:description - (lambda () - (concat (propertize "Configure " 'face 'transient-heading) - (propertize (transient-scope) 'face 'magit-branch-local))) + [:description (##concat + (propertize "Configure " 'face 'transient-heading) + (propertize (transient-scope) 'face 'magit-branch-local)) ("d" magit-branch..description) ("u" magit-branch..merge/remote) ("r" magit-branch..rebase) diff --git a/elpa/magit-20250107.2324/magit-bundle.el b/elpa/magit-20250519.1537/magit-bundle.el similarity index 97% rename from elpa/magit-20250107.2324/magit-bundle.el rename to elpa/magit-20250519.1537/magit-bundle.el index 705181ce..1cd98d55 100644 --- a/elpa/magit-20250107.2324/magit-bundle.el +++ b/elpa/magit-20250519.1537/magit-bundle.el @@ -20,6 +20,13 @@ ;; You should have received a copy of the GNU General Public License ;; along with Magit. If not, see . +;;; Commentary: + +;; This library implements support for "git bundle". +;; The entry point is the `magit-bundle' menu command. + +;; See (man "git-bundle"). + ;;; Code: (require 'magit) diff --git a/elpa/magit-20250107.2324/magit-clone.el b/elpa/magit-20250519.1537/magit-clone.el similarity index 97% rename from elpa/magit-20250107.2324/magit-clone.el rename to elpa/magit-20250519.1537/magit-clone.el index 298988af..42187eb3 100644 --- a/elpa/magit-20250107.2324/magit-clone.el +++ b/elpa/magit-20250519.1537/magit-clone.el @@ -43,9 +43,9 @@ If t, then set without asking. If nil, then don't set. If `ask', then ask." :package-version '(magit . "2.4.0") :group 'magit-commands - :type '(choice (const :tag "set" t) - (const :tag "ask" ask) - (const :tag "don't set" nil))) + :type '(choice (const :tag "Set" t) + (const :tag "Ask" ask) + (const :tag "Don't set" nil))) (defcustom magit-clone-default-directory nil "Default directory to use when `magit-clone' reads destination. @@ -54,9 +54,9 @@ If a directory, then use that. If a function, then call that with the remote url as only argument and use the returned value." :package-version '(magit . "2.90.0") :group 'magit-commands - :type '(choice (const :tag "value of default-directory") - (directory :tag "constant directory") - (function :tag "function's value"))) + :type '(choice (const :tag "Value of default-directory") + (directory :tag "Constant directory") + (function :tag "Function's value"))) (defcustom magit-clone-always-transient nil "Whether `magit-clone' always acts as a transient prefix command. @@ -308,7 +308,7 @@ Then show the status buffer for the new repository." (concat "file://" (magit-convert-filename-for-git (read-directory-name "Clone repository: file://")))) - (?b "or [b]undle" + (?b "[b]undle" (magit-convert-filename-for-git (read-file-name "Clone from bundle: "))))) diff --git a/elpa/magit-20250107.2324/magit-commit.el b/elpa/magit-20250519.1537/magit-commit.el similarity index 77% rename from elpa/magit-20250107.2324/magit-commit.el rename to elpa/magit-20250519.1537/magit-commit.el index 94ce31de..e8b84383 100644 --- a/elpa/magit-20250107.2324/magit-commit.el +++ b/elpa/magit-20250519.1537/magit-commit.el @@ -127,26 +127,34 @@ Also see https://github.com/magit/magit/issues/4132." ("-n" "Disable hooks" ("-n" "--no-verify")) ("-R" "Claim authorship and reset author date" "--reset-author") (magit:--author :description "Override the author") - (7 "-D" "Override the author date" "--date=" transient-read-date) - ("-s" "Add Signed-off-by line" ("-s" "--signoff")) - (5 magit:--gpg-sign) + (magit-commit:--date :level 7) + (magit:--gpg-sign :level 5) + (magit:--signoff) (magit-commit:--reuse-message)] [["Create" ("c" "Commit" magit-commit-create)] ["Edit HEAD" ("e" "Extend" magit-commit-extend) - ("w" "Reword" magit-commit-reword) + "" ("a" "Amend" magit-commit-amend) - (6 "n" "Reshelve" magit-commit-reshelve)] + "" + ("w" "Reword" magit-commit-reword) + ("d" "Reshelve" magit-commit-reshelve :level 0)] ["Edit" ("f" "Fixup" magit-commit-fixup) ("s" "Squash" magit-commit-squash) - ("A" "Augment" magit-commit-augment) - (6 "x" "Absorb changes" magit-commit-autofixup) - (6 "X" "Absorb modules" magit-commit-absorb-modules)] - ["" + ("A" "Alter" magit-commit-alter) + ("n" "Augment" magit-commit-augment) + ("W" "Revise" magit-commit-revise)] + ["Edit and rebase" ("F" "Instant fixup" magit-commit-instant-fixup) - ("S" "Instant squash" magit-commit-instant-squash)]] + ("S" "Instant squash" magit-commit-instant-squash) + "" + "" + ("R" "Reword past" magit-rebase-reword-commit :level 0)] + ["Spread across commits" + ("x" "Modified files" magit-commit-autofixup :level 6) + ("X" "Updated modules" magit-commit-absorb-modules :level 6)]] (interactive) (if-let ((buffer (magit-commit-message-buffer))) (switch-to-buffer buffer) @@ -155,6 +163,13 @@ Also see https://github.com/magit/magit/issues/4132." (defun magit-commit-arguments nil (transient-args 'magit-commit)) +(transient-define-argument magit-commit:--date () + :description "Override the author date" + :class 'transient-option + :shortarg "-D" + :argument "--date=" + :reader #'transient-read-date) + (transient-define-argument magit-commit:--reuse-message () :description "Reuse commit message" :class 'transient-option @@ -171,15 +186,12 @@ Also see https://github.com/magit/magit/issues/4132." "ORIG_HEAD")))) ;;; Commands +;;;; Create ;;;###autoload (defun magit-commit-create (&optional args) - "Create a new commit on `HEAD'. -With a prefix argument, amend to the commit at `HEAD' instead. -\n(git commit [--amend] ARGS)" - (interactive (if current-prefix-arg - (list (cons "--amend" (magit-commit-arguments))) - (list (magit-commit-arguments)))) + "Create a new commit." + (interactive (list (magit-commit-arguments))) (cond ((member "--all" args) (setq this-command 'magit-commit--all)) ((member "--allow-empty" args) @@ -188,22 +200,17 @@ With a prefix argument, amend to the commit at `HEAD' instead. (let ((default-directory (magit-toplevel))) (magit-run-git-with-editor "commit" args)))) -;;;###autoload -(defun magit-commit-amend (&optional args) - "Amend the last commit. -\n(git commit --amend ARGS)" - (interactive (list (magit-commit-arguments))) - (magit-commit-amend-assert) - (magit-run-git-with-editor "commit" "--amend" args)) +;;;; Edit HEAD ;;;###autoload (defun magit-commit-extend (&optional args override-date) - "Amend the last commit, without editing the message. + "Amend staged changes to the last commit, without editing its message. -With a prefix argument keep the committer date, otherwise change -it. The option `magit-commit-extend-override-date' can be used -to inverse the meaning of the prefix argument. -\n(git commit --amend --no-edit)" +With a prefix argument do not update the committer date; without an +argument update it. The option `magit-commit-extend-override-date' +can be used to inverse the meaning of the prefix argument. Called +non-interactively, the optional OVERRIDE-DATE argument controls this +behavior, and the option is of no relevance." (interactive (list (magit-commit-arguments) (if current-prefix-arg (not magit-commit-extend-override-date) @@ -217,16 +224,21 @@ to inverse the meaning of the prefix argument. (magit-run-git-with-editor "commit" "--amend" "--no-edit" args))))) ;;;###autoload -(defun magit-commit-reword (&optional args override-date) - "Reword the last commit, ignoring staged changes. +(defun magit-commit-amend (&optional args) + "Amend staged changes (if any) to the last commit, and edit its message." + (interactive (list (magit-commit-arguments))) + (magit-commit-amend-assert) + (magit-run-git-with-editor "commit" "--amend" args)) -With a prefix argument keep the committer date, otherwise change -it. The option `magit-commit-reword-override-date' can be used -to inverse the meaning of the prefix argument. +;;;###autoload +(defun magit-commit-reword (&optional args override-date) + "Reword the message of the last commit, without amending its tree. -Non-interactively respect the optional OVERRIDE-DATE argument -and ignore the option. -\n(git commit --amend --only)" +With a prefix argument do not update the committer date; without an +argument update it. The option `magit-commit-reword-override-date' +can be used to inverse the meaning of the prefix argument. Called +non-interactively, the optional OVERRIDE-DATE argument controls this +behavior, and the option is of no relevance." (interactive (list (magit-commit-arguments) (if current-prefix-arg (not magit-commit-reword-override-date) @@ -239,59 +251,133 @@ and ignore the option. (("GIT_COMMITTER_DATE" (magit-rev-format "%cD"))) (magit-run-git-with-editor "commit" "--amend" "--only" args)))) +;;;; Edit + ;;;###autoload (defun magit-commit-fixup (&optional commit args) - "Create a fixup commit. + "Create a fixup commit, leaving the original commit message untouched. + +If there is a reachable commit at point, target that. Otherwise prompt +for a commit. If `magit-commit-squash-confirm' is non-nil, always make +the user explicitly select a commit, in a buffer dedicated to that task. -With a prefix argument the target COMMIT has to be confirmed. -Otherwise the commit at point may be used without confirmation -depending on the value of option `magit-commit-squash-confirm'." +During a later rebase, when this commit gets squashed into its targeted +commit, the original message of the targeted commit is used as-is. + +In other words, call \"git commit --fixup=COMMIT --no-edit\"." (interactive (list (magit-commit-at-point) (magit-commit-arguments))) - (magit-commit-squash-internal "--fixup" commit args)) + (magit-commit-squash-internal "--fixup=" commit args)) ;;;###autoload (defun magit-commit-squash (&optional commit args) - "Create a squash commit, without editing the squash message. + "Create a squash commit, without the user authoring a commit message. + +If there is a reachable commit at point, target that. Otherwise prompt +for a commit. If `magit-commit-squash-confirm' is non-nil, always make +the user explicitly select a commit, in a buffer dedicated to that task. -With a prefix argument the target COMMIT has to be confirmed. -Otherwise the commit at point may be used without confirmation -depending on the value of option `magit-commit-squash-confirm'. +During a later rebase, when this commit gets squashed into its targeted +commit, the user is given a chance to edit the original message to take +the changes from the squash commit into account. -If you want to immediately add a message to the squash commit, -then use `magit-commit-augment' instead of this command." +In other words, call \"git commit --squash=COMMIT --no-edit\"." (interactive (list (magit-commit-at-point) (magit-commit-arguments))) - (magit-commit-squash-internal "--squash" commit args)) + (magit-commit-squash-internal "--squash=" commit args)) + +;;;###autoload +(defun magit-commit-alter (&optional commit args) + "Create a squash commit, authoring the final commit message now. + +If there is a reachable commit at point, target that. Otherwise prompt +for a commit. If `magit-commit-squash-confirm' is non-nil, always make +the user explicitly select a commit, in a buffer dedicated to that task. + +During a later rebase, when this commit gets squashed into its targeted +commit, the original message of the targeted commit is replaced with the +message of this commit, without the user automatically being given a +chance to edit again. + +In other words, call \"git commit --fixup=amend:COMMIT --edit\"." + (interactive (list (magit-commit-at-point) + (magit-commit-arguments))) + (magit-commit-squash-internal "--fixup=amend:" commit args nil 'edit)) ;;;###autoload (defun magit-commit-augment (&optional commit args) - "Create a squash commit, editing the squash message. + "Create a squash commit, authoring a new temporary commit message. + +If there is a reachable commit at point, target that. Otherwise prompt +for a commit. If `magit-commit-squash-confirm' is non-nil, always make +the user explicitly select a commit, in a buffer dedicated to that task. -With a prefix argument the target COMMIT has to be confirmed. -Otherwise the commit at point may be used without confirmation -depending on the value of option `magit-commit-squash-confirm'." +During a later rebase, when this commit gets squashed into its targeted +commit, the user is asked to write a final commit message, in a buffer +that starts out containing both the original commit message, as well as +the temporary commit message of the squash commit. + +In other words, call \"git commit --squash=COMMIT --edit\"." (interactive (list (magit-commit-at-point) (magit-commit-arguments))) - (magit-commit-squash-internal "--squash" commit args nil t)) + (magit-commit-squash-internal "--squash=" commit args nil 'edit)) + +;;;###autoload +(defun magit-commit-revise (&optional commit args) + "Reword the message of an existing commit, without editing its tree. + +If there is a reachable commit at point, target that. Otherwise prompt +for a commit. If `magit-commit-squash-confirm' is non-nil, always make +the user explicitly select a commit, in a buffer dedicated to that task. + +During a later rebase, when this commit gets squashed into its targeted +commit, a combined commit is created which uses the message of the fixup +commit and the tree of the targeted commit. + +In other words, call \"git commit --fixup=reword:COMMIT --edit\"." + (interactive (list (magit-commit-at-point) + (magit-commit-arguments))) + (magit-commit-squash-internal "--fixup=reword:" commit args 'nopatch 'edit)) + +;;;; Edit and Rebase ;;;###autoload (defun magit-commit-instant-fixup (&optional commit args) - "Create a fixup commit targeting COMMIT and instantly rebase." + "Create a fixup commit, and immediately combine it with its target. + +If there is a reachable commit at point, target that. Otherwise prompt +for a commit. If `magit-commit-squash-confirm' is non-nil, always make +the user explicitly select a commit, in a buffer dedicated to that task. + +Leave the original commit message of the targeted commit untouched. + +Like `magit-commit-fixup' but also run a `--autofixup' rebase." (interactive (list (magit-commit-at-point) (magit-commit-arguments))) - (magit-commit-squash-internal "--fixup" commit args t)) + (magit-commit-squash-internal "--fixup=" commit args nil nil 'rebase)) ;;;###autoload (defun magit-commit-instant-squash (&optional commit args) - "Create a squash commit targeting COMMIT and instantly rebase." + "Create a squash commit, and immediately combine it with its target. + +If there is a reachable commit at point, target that. Otherwise prompt +for a commit. If `magit-commit-squash-confirm' is non-nil, always make +the user explicitly select a commit, in a buffer dedicated to that task. + +Turing the rebase phase, when the two commits are being squashed, ask +the user to author the final commit message, based on the original +message of the targeted commit. + +Like `magit-commit-squash' but also run a `--autofixup' rebase." (interactive (list (magit-commit-at-point) (magit-commit-arguments))) - (magit-commit-squash-internal "--squash" commit args t)) + (magit-commit-squash-internal "--squash=" commit args nil nil 'rebase)) + +;;;; Internal (defun magit-commit-squash-internal - (option commit &optional args rebase edit confirmed) - (when-let ((args (magit-commit-assert args (not edit)))) + (option commit &optional args nopatch edit rebase confirmed) + (when-let ((args (magit-commit-assert args nopatch (not edit)))) (when (and commit rebase (not (magit-rev-ancestor-p commit "HEAD"))) (magit-read-char-case (format "%s isn't an ancestor of HEAD. " commit) nil @@ -306,9 +392,8 @@ depending on the value of option `magit-commit-squash-confirm'." current-prefix-arg magit-commit-squash-confirm)))) (let ((magit-commit-show-diff nil)) - (push (concat option "=" commit) args) - (unless edit - (push "--no-edit" args)) + (push (concat option commit) args) + (push (if edit "--edit" "--no-edit") args) (if rebase (magit-with-editor (magit-call-git @@ -322,7 +407,7 @@ depending on the value of option `magit-commit-squash-confirm'." (magit-log-select (lambda (commit) (when (and (magit-commit-squash-internal option commit args - rebase edit t) + nopatch edit rebase t) rebase) (magit-commit-amend-assert commit) (magit-rebase-interactive-1 commit @@ -333,7 +418,7 @@ depending on the value of option `magit-commit-squash-confirm'." (format "Type %%p on a commit to %s into it," (substring option 2)) nil nil nil commit)) - (when magit-commit-show-diff + (when (and magit-commit-show-diff (not nopatch)) (let ((magit-display-buffer-noselect t)) (apply #'magit-diff-staged nil (magit-diff-arguments))))))) @@ -346,8 +431,9 @@ depending on the value of option `magit-commit-squash-confirm'." (concat m1 "%d public branches" m2) nil branches)))) -(defun magit-commit-assert (args &optional strict) +(defun magit-commit-assert (args &optional nopatch strict) (cond + (nopatch (or args (list "--"))) ((or (magit-anything-staged-p) (and (magit-anything-unstaged-p) ;; ^ Everything of nothing is still nothing. @@ -379,7 +465,7 @@ depending on the value of option `magit-commit-squash-confirm'." (user-error "Nothing staged (or unstaged)")) (magit-commit-ask-to-stage (when (eq magit-commit-ask-to-stage 'verbose) - (magit-diff-unstaged)) + (apply #'magit-diff-unstaged (magit-diff-arguments))) (prog1 (when (or (eq magit-commit-ask-to-stage 'stage) (y-or-n-p "Nothing staged. Commit all uncommitted changes? ")) @@ -391,11 +477,13 @@ depending on the value of option `magit-commit-squash-confirm'." (t (user-error "Nothing staged")))) +;;;; Reshelve + (defvar magit--reshelve-history nil) ;;;###autoload (defun magit-commit-reshelve (date update-author &optional args) - "Change the committer date and possibly the author date of `HEAD'. + "Change committer (and possibly author) date of the last commit. The current time is used as the initial minibuffer input and the original author or committer date is available as the previous @@ -425,6 +513,8 @@ is updated: (and update-author (concat "--date=" date)) args))) +;;;; Spread + ;;;###autoload (defun magit-commit-absorb-modules (phase commit) "Spread modified modules across recent commits." @@ -489,17 +579,19 @@ See `magit-commit-autofixup' for an alternative implementation." (magit-commit-absorb 'run commit args))) nil nil nil nil commit)))) +(transient-augment-suffix magit-commit-absorb :transient 'transient--do-exit) + ;;;###autoload (autoload 'magit-commit-autofixup "magit-commit" nil t) (transient-define-prefix magit-commit-autofixup (phase commit args) "Spread staged or unstaged changes across recent commits. -If there are any staged then spread only those, otherwise -spread all unstaged changes. With a prefix argument use a -transient command to select infix arguments. +If there are any staged then spread only those, otherwise spread all +unstaged changes. With a prefix argument use a transient command to +select infix arguments. -This command requires the git-autofixup script, which is -available from https://github.com/torbiak/git-autofixup. -See `magit-commit-absorb' for an alternative implementation." +This command requires the git-autofixup script, which is available from +https://github.com/torbiak/git-autofixup. See `magit-commit-absorb' for +an alternative implementation." :value '("-vv") ["Arguments" (magit-autofixup:--context) @@ -529,6 +621,8 @@ See `magit-commit-absorb' for an alternative implementation." (magit-commit-autofixup 'run commit args))) nil nil nil nil commit)))) +(transient-augment-suffix magit-commit-autofixup :transient 'transient--do-exit) + (transient-define-argument magit-autofixup:--context () :description "Diff context lines" :class 'transient-option @@ -543,6 +637,8 @@ See `magit-commit-absorb' for an alternative implementation." :argument "--strict=" :reader #'transient-read-number-N0) +;;;; Hooks + (defvar magit-post-commit-hook-commands (list #'magit-commit-extend #'magit-commit-fixup @@ -650,10 +746,10 @@ See `magit-commit-absorb' for an alternative implementation." (defun magit-commit-message-buffer () (let* ((find-file-visit-truename t) ; git uses truename of COMMIT_EDITMSG (topdir (magit-toplevel))) - (--first (equal topdir (with-current-buffer it - (and git-commit-mode (magit-toplevel)))) - (append (buffer-list (selected-frame)) - (buffer-list))))) + (seq-find (##equal topdir (with-current-buffer % + (and git-commit-mode (magit-toplevel)))) + (append (buffer-list (selected-frame)) + (buffer-list))))) (defvar magit-commit-add-log-insert-function #'magit-commit-add-log-insert "Used by `magit-commit-add-log' to insert a single entry.") diff --git a/elpa/magit-20250107.2324/magit-core.el b/elpa/magit-20250519.1537/magit-core.el similarity index 100% rename from elpa/magit-20250107.2324/magit-core.el rename to elpa/magit-20250519.1537/magit-core.el diff --git a/elpa/magit-20250107.2324/magit-diff.el b/elpa/magit-20250519.1537/magit-diff.el similarity index 89% rename from elpa/magit-20250107.2324/magit-diff.el rename to elpa/magit-20250519.1537/magit-diff.el index 6eabd534..02cbbc71 100644 --- a/elpa/magit-20250107.2324/magit-diff.el +++ b/elpa/magit-20250519.1537/magit-diff.el @@ -73,7 +73,7 @@ (declare-function magit-commit-add-log "magit-commit" ()) (declare-function magit-diff-trace-definition "magit-log" ()) (declare-function magit-patch-save "magit-patch" (files &optional arg)) -(declare-function magit-do-async-shell-command "magit-extras" (file)) +(declare-function magit-do-async-shell-command "magit-dired" (file)) (declare-function magit-add-change-log-entry "magit-extras" (&optional whoami file-name other-window)) (declare-function magit-add-change-log-entry-other-window "magit-extras" @@ -94,11 +94,11 @@ 'magit-diff-section-map "Magit 4.0.0") (define-obsolete-variable-alias 'magit-wash-message-hook - 'magit-revision-wash-message-hook "Magit 4.2.1") + 'magit-revision-wash-message-hook "Magit 4.3.0") (make-obsolete-variable 'magit-diff-highlight-keywords 'magit-revision-wash-message-hook - "Magit 4.2.1") + "Magit 4.3.0") ;;; Options ;;;; Diff Mode @@ -115,8 +115,8 @@ :type 'hook) (defcustom magit-diff-sections-hook - '(magit-insert-diff - magit-insert-xref-buttons) + (list #'magit-insert-diff + #'magit-insert-xref-buttons) "Hook run to insert sections into a `magit-diff-mode' buffer." :package-version '(magit . "2.3.0") :group 'magit-diff @@ -141,9 +141,7 @@ to have any effect." :type 'float) (defcustom magit-diff-highlight-hunk-body t - "Whether to highlight bodies of selected hunk sections. -This only has an effect if `magit-diff-highlight' is a -member of `magit-section-highlight-hook', which see." + "Whether to highlight bodies of selected hunk sections." :package-version '(magit . "2.1.0") :group 'magit-diff :type 'boolean) @@ -193,11 +191,11 @@ keep their distinct foreground colors." (defcustom magit-diff-refine-hunk nil "Whether to show word-granularity differences within diff hunks. -nil Never show fine differences. -t Show fine differences for the current diff hunk only. +`nil' Never show fine differences. +`t' Show fine differences for the current diff hunk only. `all' Show fine differences for all displayed diff hunks." :group 'magit-diff - :safe (lambda (val) (memq val '(nil t all))) + :safe (##memq % '(nil t all)) :type '(choice (const :tag "Never" nil) (const :tag "Current" t) (const :tag "All" all))) @@ -217,13 +215,13 @@ t Show fine differences for the current diff hunk only. Determining the correct width can be expensive if it requires opening large and/or many files, so the widths are cached in -the variable `magit-diff--tab-width-cache'. Set that to nil +the variable `magit-diff--tab-width-cache'. Set that to `nil' to invalidate the cache. -nil Never adjust tab width. Use `tab-width's value from +`nil' Never adjust tab width. Use `tab-width's value from the Magit buffer itself instead. -t If the corresponding file-visiting buffer exits, then +`t' If the corresponding file-visiting buffer exits, then use `tab-width's value from that buffer. Doing this is cheap, so this value is used even if a corresponding cache entry exists. @@ -243,8 +241,8 @@ NUMBER Like `always', but don't visit files larger than NUMBER (defcustom magit-diff-paint-whitespace t "Specify where to highlight whitespace errors. -nil Never highlight whitespace errors. -t Highlight whitespace errors everywhere. +`nil' Never highlight whitespace errors. +`t' Highlight whitespace errors everywhere. `uncommitted' Only highlight whitespace errors in diffs showing uncommitted changes. @@ -258,7 +256,7 @@ The options `magit-diff-highlight-trailing' and `magit-diff-highlight-indentation' control what kind of whitespace errors are highlighted." :group 'magit-diff - :safe (lambda (val) (memq val '(t nil uncommitted status))) + :safe (##memq % '(t nil uncommitted status)) :type '(choice (const :tag "In all diffs" t) (const :tag "Only in uncommitted changes" uncommitted) (const :tag "Never" nil))) @@ -266,15 +264,15 @@ whitespace errors are highlighted." (defcustom magit-diff-paint-whitespace-lines t "Specify in what kind of lines to highlight whitespace errors. -t Highlight only in added lines. +`t' Highlight only in added lines. `both' Highlight in added and removed lines. `all' Highlight in added, removed and context lines." :package-version '(magit . "3.0.0") :group 'magit-diff - :safe (lambda (val) (memq val '(t both all))) - :type '(choice (const :tag "in added lines" t) - (const :tag "in added and removed lines" both) - (const :tag "in added, removed and context lines" all))) + :safe (##memq % '(t both all)) + :type '(choice (const :tag "In added lines" t) + (const :tag "In added and removed lines" both) + (const :tag "In added, removed and context lines" all))) (defcustom magit-diff-highlight-trailing t "Whether to highlight whitespace at the end of a line in diffs. @@ -317,11 +315,26 @@ here: `--stat-width', `--stat-name-width', `--stat-graph-width' and `--compact-summary'. See the git-diff(1) manpage." :package-version '(magit . "3.0.0") :group 'magit-diff - :type '(radio (function-item magit-diff-use-window-width-as-stat-width) + :type `(radio (function-item ,#'magit-diff-use-window-width-as-stat-width) function (list string) (const :tag "None" nil))) +(defcustom magit-format-file-function #'magit-format-file-default + "Function used to format lines representing a file. + +This function is used for file headings in diffs, in diffstats and for +lists of files (such as the untracked files). Depending on the caller, +it receives either three or five arguments; the signature has to be +\(kind file face &optional status orig). KIND is one of `diff', +`module', `stat' and `list'." + :package-version '(magit . "4.3.1") + :group 'magit-diff + :type `(radio (function-item ,#'magit-format-file-default) + (function-item ,#'magit-format-file-all-the-icons) + (function-item ,#'magit-format-file-nerd-icons) + function)) + ;;;; File Diff (defcustom magit-diff-buffer-file-locked t @@ -339,8 +352,8 @@ and `--compact-summary'. See the git-diff(1) manpage." :group 'magit-modes) (defcustom magit-revision-mode-hook - '(bug-reference-mode - goto-address-mode) + (list #'bug-reference-mode + #'goto-address-mode) "Hook run after entering Magit-Revision mode." :group 'magit-revision :type 'hook @@ -371,7 +384,7 @@ beginning of the narrowed region of the buffer. See also the related `magit-log-wash-summary-hook'. You likely want to use the same functions for both hooks." - :package-version '(magit . "4.2.1") + :package-version '(magit . "4.3.0") :group 'magit-log :type 'hook :options (list #'magit-highlight-squash-markers @@ -395,7 +408,7 @@ subject to option `magit-revision-insert-related-refs'." :type 'string) (defcustom magit-revision-insert-related-refs t - "Whether to show related branches in revision buffers + "Whether to show related branches in revision buffers. `nil' Don't show any related branches. `t' Show related local branches. @@ -406,10 +419,10 @@ See user option `magit-revision-insert-related-refs-display-alist' to hide specific sets of related branches." :package-version '(magit . "2.1.0") :group 'magit-revision - :type '(choice (const :tag "don't" nil) - (const :tag "local only" t) - (const :tag "all related" all) - (const :tag "all containing, local merged" mixed))) + :type '(choice (const :tag "Do not" nil) + (const :tag "Local only" t) + (const :tag "All related" all) + (const :tag "All containing, local merged" mixed))) (defcustom magit-revision-insert-related-refs-display-alist nil "How `magit-insert-revision-headers' displays related branch types. @@ -422,7 +435,7 @@ and the supported values for each key being: `t' Show these related branches. Keys which are not present in the alist have an implicit value `t' -\(so the default alist value of nil means all related branch types +\(so the default alist value of `nil' means all related branch types will be shown.) The types to be shown are additionally subject to user option @@ -450,7 +463,7 @@ performance and reliability: long and which contain at least one number as well as at least one letter. -If nil, then no hashes are turned into sections, but you can +If `nil', then no hashes are turned into sections, but you can still visit the commit at point using \"RET\"." :package-version '(magit . "2.12.0") :group 'magit-revision @@ -463,9 +476,9 @@ still visit the commit at point using \"RET\"." (defcustom magit-revision-show-gravatars nil "Whether to show gravatar images in revision buffers. -If nil, then don't insert any gravatar images. If t, then insert -both images. If `author' or `committer', then insert only the -respective image. +If `nil', then don't insert any gravatar images. If `t', then +insert both images. If `author' or `committer', then insert +only the respective image. If you have customized the option `magit-revision-header-format' and want to insert the images then you might also have to specify @@ -474,7 +487,7 @@ two regular expressions. The car specifies where to insert the author's image. The top half of the image is inserted right after the matched text, the bottom half on the next line in the same column. The cdr specifies where to insert the committer's -image, accordingly. Either the car or the cdr may be nil." +image, accordingly. Either the car or the cdr may be `nil'." :package-version '(magit . "2.3.0") :group 'magit-revision :type '(choice @@ -817,12 +830,12 @@ and `:slant'." (when-let (((not (eq transient-current-command 'magit-dispatch))) (file (magit-file-relative-name))) (setq files (list file))) - (oset obj value (if files `(("--" ,@files) ,args) args)))) + (oset obj value (if files `(("--" ,@files) ,@args) args)))) (cl-defmethod transient-init-value ((obj magit-diff-refresh-prefix)) (oset obj value (if magit-buffer-diff-files `(("--" ,@magit-buffer-diff-files) - ,magit-buffer-diff-args) + ,@magit-buffer-diff-args) magit-buffer-diff-args))) (cl-defmethod transient-set-value ((obj magit-diff-prefix)) @@ -882,37 +895,35 @@ and `:slant'." ;;; Commands ;;;; Prefix Commands -(eval-and-compile - (defvar magit-diff-infix-arguments - [:class transient-subgroups - ["Limit arguments" - (magit:--) - (magit-diff:--ignore-submodules) - ("-b" "Ignore whitespace changes" ("-b" "--ignore-space-change")) - ("-w" "Ignore all whitespace" ("-w" "--ignore-all-space")) - ("-D" "Omit preimage for deletes" ("-D" "--irreversible-delete") - :level 5)] - ["Context arguments" - (magit-diff:-U) - ("-W" "Show surrounding functions" ("-W" "--function-context"))] - ["Tune arguments" - (magit-diff:--diff-algorithm) - (magit-diff:--diff-merges) - (magit-diff:-M) - (magit-diff:-C) - (magit-diff:-R :level 5) - (magit-diff:--color-moved :level 5) - (magit-diff:--color-moved-ws :level 5) - (magit-diff:--no-ext-diff) - (magit-diff:--stat) - (magit-diff:--show-signature)]])) +(transient-define-group magit-diff-infix-arguments + ["Limit arguments" + (magit:--) + (magit-diff:--ignore-submodules) + ("-b" "Ignore whitespace changes" ("-b" "--ignore-space-change")) + ("-w" "Ignore all whitespace" ("-w" "--ignore-all-space")) + ("-D" "Omit preimage for deletes" ("-D" "--irreversible-delete") + :level 5)] + ["Context arguments" + (magit-diff:-U) + ("-W" "Show surrounding functions" ("-W" "--function-context"))] + ["Tune arguments" + (magit-diff:--diff-algorithm) + (magit-diff:--diff-merges) + (magit-diff:-M) + (magit-diff:-C) + (magit-diff:-R :level 5) + (magit-diff:--color-moved :level 5) + (magit-diff:--color-moved-ws :level 5) + (magit-diff:--no-ext-diff) + (magit-diff:--stat) + (magit-diff:--show-signature)]) ;;;###autoload (autoload 'magit-diff "magit-diff" nil t) (transient-define-prefix magit-diff () "Show changes between different versions." :man-page "git-diff" :class 'magit-diff-prefix - [magit-diff-infix-arguments] + 'magit-diff-infix-arguments ["Actions" [("d" "Dwim" magit-diff-dwim) ("r" "Diff range" magit-diff-range) @@ -928,7 +939,7 @@ and `:slant'." "Change the arguments used for the diff(s) in the current buffer." :man-page "git-diff" :class 'magit-diff-refresh-prefix - [magit-diff-infix-arguments] + 'magit-diff-infix-arguments [["Refresh" ("g" "buffer" magit-diff-refresh) ("s" "buffer and set defaults" transient-set-and-exit) @@ -1093,7 +1104,7 @@ and `:slant'." :if 'magit-diff-argument-predicate) (defun magit-diff-argument-predicate () - (or (eq transient--prefix 'magit-diff) + (or (eq (oref transient--prefix command) 'magit-diff) (derived-mode-p 'magit-diff-mode))) ;;;; Setup Commands @@ -1408,9 +1419,8 @@ for a revision." (magit-diff--goto-position file line col)))))))) (defun magit-diff--locate-hunk (file line &optional parent) - (and-let* ((diff (cl-find-if (lambda (section) - (and (cl-typep section 'magit-file-section) - (equal (oref section value) file))) + (and-let* ((diff (cl-find-if (##and (cl-typep % 'magit-file-section) + (equal (oref % value) file)) (oref (or parent magit-root-section) children)))) (let ((hunks (oref diff children))) (cl-block nil @@ -1443,7 +1453,6 @@ for a revision." (when (oref section hidden) (magit-section-show section)) (setq section (oref section parent)))) - (magit-section-update-highlight) t)) ;;;; Setting Commands @@ -1507,12 +1516,12 @@ instead." (defun magit-diff-less-context (&optional count) "Decrease the context for diff hunks by COUNT lines." (interactive "p") - (magit-diff-set-context (lambda (cur) (max 0 (- (or cur 0) count))))) + (magit-diff-set-context (##max 0 (- (or % 0) count)))) (defun magit-diff-more-context (&optional count) "Increase the context for diff hunks by COUNT lines." (interactive "p") - (magit-diff-set-context (lambda (cur) (+ (or cur 0) count)))) + (magit-diff-set-context (##+ (or % 0) count))) (defun magit-diff-default-context () "Reset context for diff hunks to the default height." @@ -1526,7 +1535,7 @@ instead." (string-to-number context) 3)) (val magit-buffer-diff-args) - (arg (--first (string-match "^-U\\([0-9]+\\)?$" it) val)) + (arg (seq-find (##string-match "^-U\\([0-9]+\\)?$" %) val)) (num (if-let ((str (and arg (match-string 1 arg)))) (string-to-number str) def)) @@ -1538,18 +1547,18 @@ instead." (magit-refresh)) (defun magit-diff-context-p () - (if-let ((arg (--first (string-match "^-U\\([0-9]+\\)$" it) - magit-buffer-diff-args))) + (if-let ((arg (seq-find (##string-match "^-U\\([0-9]+\\)$" %) + magit-buffer-diff-args))) (not (equal arg "-U0")) t)) (defun magit-diff-ignore-any-space-p () - (--any-p (member it magit-buffer-diff-args) - '("--ignore-cr-at-eol" - "--ignore-space-at-eol" - "--ignore-space-change" "-b" - "--ignore-all-space" "-w" - "--ignore-blank-space"))) + (seq-some (##member % magit-buffer-diff-args) + '("--ignore-cr-at-eol" + "--ignore-space-at-eol" + "--ignore-space-change" "-b" + "--ignore-all-space" "-w" + "--ignore-blank-space"))) (defun magit-diff-toggle-refine-hunk (&optional style) "Turn diff-hunk refining on or off. @@ -1582,9 +1591,9 @@ Display the buffer in the selected window. With a prefix argument OTHER-WINDOW display the buffer in another window instead. -Visit the worktree version of the appropriate file. The location -of point inside the diff determines which file is being visited. -The visited version depends on what changes the diff is about. +The location of point inside the diff determines which file is +being visited. The visited version depends on what changes the +diff is about. 1. If the diff shows uncommitted changes (i.e., stage or unstaged changes), then visit the file in the working tree (i.e., the @@ -1867,6 +1876,23 @@ the Magit-Status buffer for DIRECTORY." (throw 'found nil)))))) (+ line offset))) +;;;;; Movement + +(defun magit-jump-to-diffstat-or-diff () + "Jump to the diffstat or diff. +When point is on a file inside the diffstat section, then jump +to the respective diff section, otherwise jump to the diffstat +section or a child thereof." + (interactive) + (if-let ((section (magit-get-section + (append (magit-section-case + ([file diffstat] `((file . ,(oref it value)))) + (file `((file . ,(oref it value)) (diffstat))) + (t '((diffstat)))) + (magit-section-ident magit-root-section))))) + (magit-section-goto section) + (user-error "No diffstat in this buffer"))) + ;;;; Scroll Commands (defun magit-diff-show-or-scroll-up () @@ -1952,23 +1978,24 @@ commit or stash at point, then prompt for a commit." (interactive) (when-let ((sections (cond ((derived-mode-p 'magit-status-mode) - (--mapcat - (when it - (when (oref it hidden) - (magit-section-show it)) - (oref it children)) - (list (magit-get-section '((staged) (status))) - (magit-get-section '((unstaged) (status)))))) + (mapcan (lambda (section) + (and section + (progn + (when (oref section hidden) + (magit-section-show section)) + (oref section children)))) + (list (magit-get-section '((staged) (status))) + (magit-get-section '((unstaged) (status)))))) ((derived-mode-p 'magit-diff-mode) (seq-filter #'magit-file-section-p (oref magit-root-section children)))))) - (if (--any-p (oref it hidden) sections) + (if (seq-some (##oref % hidden) sections) (dolist (s sections) (magit-section-show s) (magit-section-hide-children s)) - (let ((children (--mapcat (oref it children) sections))) - (cond ((and (--any-p (oref it hidden) children) - (--any-p (oref it children) children)) + (let ((children (mapcan (##copy-sequence (oref % children)) sections))) + (cond ((and (seq-some (##oref % hidden) children) + (seq-some (##oref % children) children)) (mapc #'magit-section-show-headings sections)) ((seq-some #'magit-section-hidden-body children) (mapc #'magit-section-show-children sections)) @@ -2092,8 +2119,8 @@ keymap is the parent of their keymaps." " " #'magit-diff-visit-file " " #'magit-reverse " " #'magit-discard - " " #'magit-unstage - " " #'magit-stage + " " #'magit-unstage + " " #'magit-stage " " #'magit-apply "<8>" (magit-menu-item "Rename file" #'magit-file-rename '(:enable (eq (magit-diff-scope) 'file))) @@ -2128,10 +2155,14 @@ keymap is the parent of their keymaps." "b" #'magit-smerge-keep-base "l" #'magit-smerge-keep-lower) -(defvar-keymap magit-hunk-section-map - :doc "Keymap for `hunk' sections." - :parent magit-diff-section-base-map - (key-description smerge-command-prefix) magit-hunk-section-smerge-map) +(defvar magit-hunk-section-map + (let ((map (make-sparse-keymap)) + (key (key-description smerge-command-prefix))) + (when (key-valid-p key) + (keymap-set map key magit-hunk-section-smerge-map)) + (set-keymap-parent map magit-diff-section-base-map) + map) + "Keymap for `hunk' sections.") (defconst magit-diff-conflict-headline-re (concat "^" (regexp-opt @@ -2195,7 +2226,7 @@ keymap is the parent of their keymaps." (unless (equal cmd "merge-tree") (push "--ita-visible-in-index" args)) (setq args (magit-diff--maybe-add-stat-arguments args)) - (when (cl-member-if (lambda (arg) (string-prefix-p "--color-moved" arg)) args) + (when (cl-member-if (##string-prefix-p "--color-moved" %) args) (push "--color=always" args) (setq magit-git-global-arguments (append magit-diff--reset-non-color-moved @@ -2203,7 +2234,7 @@ keymap is the parent of their keymaps." (magit--git-wash #'magit-diff-wash-diffs (if (member "--no-index" args) 'wash-anyway - (or keep-error magit--git-wash-keep-error)) + (or keep-error t)) cmd args))) (defun magit-diff--maybe-add-stat-arguments (args) @@ -2227,24 +2258,9 @@ keymap is the parent of their keymaps." (magit-diff-wash-diffstat)) (when (re-search-forward magit-diff-headline-re limit t) (goto-char (line-beginning-position)) - (magit-wash-sequence (apply-partially #'magit-diff-wash-diff args)) + (magit-wash-sequence (##magit-diff-wash-diff args)) (insert ?\n))) -(defun magit-jump-to-diffstat-or-diff () - "Jump to the diffstat or diff. -When point is on a file inside the diffstat section, then jump -to the respective diff section, otherwise jump to the diffstat -section or a child thereof." - (interactive) - (if-let ((section (magit-get-section - (append (magit-section-case - ([file diffstat] `((file . ,(oref it value)))) - (file `((file . ,(oref it value)) (diffstat))) - (t '((diffstat)))) - (magit-section-ident magit-root-section))))) - (magit-section-goto section) - (user-error "No diffstat in this buffer"))) - (defun magit-diff-wash-signature (object) (cond ((looking-at "^No signature") @@ -2278,8 +2294,8 @@ section or a child thereof." (magit-delete-match) (goto-char beg) (magit-insert-section (diffstat) - (insert (propertize heading 'font-lock-face 'magit-diff-file-heading)) - (magit-insert-heading) + (magit-insert-heading + (propertize heading 'font-lock-face 'magit-diff-file-heading)) (let (files) (while (looking-at "^[-0-9]+\t[-0-9]+\t\\(.+\\)$") (push (magit-decode-git-path @@ -2305,8 +2321,8 @@ section or a child thereof." (when (> le ld) (setq sep (concat (make-string (- le ld) ?\s) sep)))) (magit-insert-section (file (pop files)) - (insert (propertize file 'font-lock-face 'magit-filename) - sep cnt " ") + (insert (magit-format-file 'stat file 'magit-filename)) + (insert sep cnt " ") (when add (insert (propertize add 'font-lock-face 'magit-diffstat-added))) @@ -2317,7 +2333,7 @@ section or a child thereof." (if (looking-at "^$") (forward-line) (insert "\n")))))) (defun magit-diff-wash-diff (args) - (when (cl-member-if (lambda (arg) (string-prefix-p "--color-moved" arg)) args) + (when (cl-member-if (##string-prefix-p "--color-moved" %) args) (require 'ansi-color) (ansi-color-apply-on-region (point-min) (point-max))) (cond @@ -2432,7 +2448,7 @@ section or a child thereof." (setq header (nreverse header)) ;; KLUDGE `git-log' ignores `--no-prefix' when `-L' is used. (when (and (derived-mode-p 'magit-log-mode) - (seq-some (lambda (arg) (string-prefix-p "-L" arg)) + (seq-some (##string-prefix-p "-L" %) magit-buffer-log-args)) (when orig (setq orig (substring orig 2))) @@ -2457,26 +2473,68 @@ section or a child thereof." :source (and (not (equal orig file)) orig) :header header :binary binary) - (insert (propertize (format "%-10s %s" status - (if (or (not orig) (equal orig file)) - file - (format "%s -> %s" orig file))) - 'font-lock-face 'magit-diff-file-heading)) - (cond ((and binary long-status) - (insert (format " (%s, binary)" long-status))) - ((or binary long-status) - (insert (format " (%s)" (if binary "binary" long-status))))) - (magit-insert-heading) + (magit-insert-heading + (magit-format-file 'diff file 'magit-diff-file-heading status + (and (not (equal orig file)) orig)) + (cond ((and binary long-status) + (format " (%s, binary)" long-status)) + ((or binary long-status) + (format " (%s)" (if binary "binary" long-status))))) (when modes (magit-insert-section (hunk '(chmod)) - (insert modes) - (magit-insert-heading))) + (magit-insert-heading (propertize modes 'face 'default)))) (when rename (magit-insert-section (hunk '(rename)) - (insert rename) - (magit-insert-heading))) + (magit-insert-heading (propertize rename 'face 'default)))) (magit-wash-sequence #'magit-diff-wash-hunk))) +(defun magit-format-file (kind file face &optional status orig) + (funcall magit-format-file-function kind file face status orig)) + +(defun magit-format-file-default (_kind file face &optional status orig) + "Show only the Git status and the filename." + (propertize (concat (and status (format "%-11s" status)) + (if orig (format "%s -> %s" orig file) file)) + 'font-lock-face face)) + +(defun magit-format-file-all-the-icons (kind file face &optional status orig) + "Show the status, filename and icon (using the `all-the-icons' package). +You have to explicitly install the `all-the-icons' package, else this +function errors." + (cl-flet ((icon (if (or (eq kind 'module) (string-suffix-p "/" file)) + 'all-the-icons-icon-for-dir + 'all-the-icons-icon-for-file))) + (cl-letf (((symbol-function 'all-the-icons-dir-is-submodule) + (if (eq kind 'module) + (lambda (_) t) + (symbol-function 'all-the-icons-dir-is-submodule)))) + (propertize (concat (and status (format "%-11s" status)) + (if orig + (format "%s %s -> %s %s" + (icon orig) orig + (icon file) file) + (format "%s %s" (icon file) file))) + 'font-lock-face face)))) + +(defun magit-format-file-nerd-icons (kind file face &optional status orig) + "Show the status, filename and icon (using the `nerd-icons' package). +You have to explicitly install the `nerd-icons' package, else this +function errors." + (cl-flet ((icon (if (or (eq kind 'module) (string-suffix-p "/" file)) + 'nerd-icons-icon-for-dir + 'nerd-icons-icon-for-file))) + (cl-letf (((symbol-function 'nerd-icons-dir-is-submodule) + (if (eq kind 'module) + (lambda (_) t) + (symbol-function 'nerd-icons-dir-is-submodule)))) + (propertize (concat (and status (format "%-11s" status)) + (if orig + (format "%s %s -> %s %s" + (icon orig) orig + (icon file) file) + (format "%s %s" (icon file) file))) + 'font-lock-face face)))) + (defun magit-diff-wash-submodule () ;; See `show_submodule_summary' in submodule.c and "this" commit. (when (looking-at "^Submodule \\([^ ]+\\)") @@ -2500,8 +2558,8 @@ section or a child thereof." "..." range t t 1))) (magit-insert-section (module module t) (magit-insert-heading - (propertize (concat "modified " module) - 'font-lock-face 'magit-diff-file-heading) + (magit-format-file 'module module 'magit-diff-file-heading + "modified") " (" (cond (rewind "rewind") ((string-search "..." range) "non-ff") @@ -2526,14 +2584,14 @@ section or a child thereof." (magit-delete-line) (magit-insert-section (module module) (magit-insert-heading - (propertize (concat "submodule " module) - 'font-lock-face 'magit-diff-file-heading) + (magit-format-file 'module module 'magit-diff-file-heading + "submodule") " (" msg ")")))) (t (magit-insert-section (module module) (magit-insert-heading - (propertize (concat "modified " module) - 'font-lock-face 'magit-diff-file-heading) + (magit-format-file 'module module 'magit-diff-file-heading + "modified") " (" (and modified "modified") (and modified untracked " and ") @@ -2559,14 +2617,13 @@ section or a child thereof." (magit-delete-line) (magit-insert-section ( hunk value nil - :washer #'magit-diff-paint-hunk :combined combined :from-range (if combined (butlast ranges) (car ranges)) :to-range (car (last ranges)) :about about) - (insert (propertize (concat heading "\n") - 'font-lock-face 'magit-diff-hunk-heading)) - (magit-insert-heading) + (magit-insert-heading + (propertize (concat heading "\n") + 'font-lock-face 'magit-diff-hunk-heading)) (while (not (or (eobp) (looking-at "^[^-+\s\\]"))) (forward-line)))) t)) @@ -2574,7 +2631,7 @@ section or a child thereof." (defun magit-diff-expansion-threshold (section) "Keep new diff sections collapsed if washing takes too long." (and (magit-file-section-p section) - (> (float-time (time-since magit-refresh-start-time)) + (> (float-time (time-since magit--refresh-start-time)) magit-diff-expansion-threshold) 'hide)) @@ -2668,9 +2725,9 @@ or a ref which is not a branch, then it inserts nothing." (match-string 1) (match-string 2)))) (magit-delete-line) - (insert (propertize heading 'font-lock-face - 'magit-section-secondary-heading))) - (magit-insert-heading) + (magit-insert-heading + (propertize heading 'font-lock-face + 'magit-section-secondary-heading))) (forward-line) (magit-insert-section ( message nil nil @@ -2716,7 +2773,8 @@ or a ref which is not a branch, then it inserts nothing." (save-excursion (magit--add-face-text-property (point) (progn (forward-line) (point)) - 'magit-diff-revision-summary) + 'magit-diff-revision-summary + t nil t) (magit-insert-heading)) (goto-char (point-max))) (insert "(no message)\n")))) @@ -2745,7 +2803,8 @@ or a ref which is not a branch, then it inserts nothing." 'font-lock-face 'magit-refname)))) (magit--add-face-text-property (point) (progn (forward-line) (point)) - 'magit-diff-revision-summary) + 'magit-diff-revision-summary + t nil t) (magit-insert-heading) (goto-char (point-max)) (insert ?\n)))))) @@ -2771,7 +2830,7 @@ or a ref which is not a branch, then it inserts nothing." (defun magit-highlight-squash-markers () "Highlight \"squash!\" and similar markers." - (when (looking-at "\\(?:squash\\|fixup\\)!") + (when (looking-at "\\(?:squash!\\|fixup!\\|amend!\\)") (magit--add-face-text-property (match-beginning 0) (match-end 0) 'magit-keyword-squash))) @@ -2818,13 +2877,13 @@ or a ref which is not a branch, then it inserts nothing." (defun magit-insert-revision-headers () "Insert headers about the commit into a revision buffer." (magit-insert-section (headers) - (when-let ((string (magit-rev-format "%D" magit-buffer-revision - "--decorate=full"))) - (insert (magit-format-ref-labels string) ?\s)) - (insert (propertize - (magit-rev-parse (magit--rev-dereference magit-buffer-revision)) - 'font-lock-face 'magit-hash)) - (magit-insert-heading) + (magit-insert-heading nil + (and-let* ((string (magit-rev-format "%D" magit-buffer-revision + "--decorate=full"))) + (concat (magit-format-ref-labels string) " ")) + (propertize + (magit-rev-parse (magit--rev-dereference magit-buffer-revision)) + 'font-lock-face 'magit-hash)) (let ((beg (point))) (magit-rev-insert-format magit-revision-headers-format magit-buffer-revision) @@ -2877,18 +2936,18 @@ Refer to user option `magit-revision-insert-related-refs-display-alist'." (defun magit--insert-related-refs (rev arg title remote) (when-let ((refs (magit-list-related-branches arg rev (and remote "-a")))) - (insert title ":" (make-string (- 10 (length title)) ?\s)) - (dolist (branch refs) - (if (<= (+ (current-column) 1 (length branch)) - (window-width)) - (insert ?\s) - (insert ?\n (make-string 12 ?\s))) - (magit-insert-section (branch branch) + (magit-insert-section (related-refs) + (insert title ":" (make-string (- 10 (length title)) ?\s)) + (dolist (branch refs) + (if (<= (+ (current-column) 1 (length branch)) + (window-width)) + (insert ?\s) + (insert ?\n (make-string 12 ?\s))) (insert (propertize branch 'font-lock-face (if (string-prefix-p "remotes/" branch) 'magit-branch-remote - 'magit-branch-local))))) - (insert ?\n))) + 'magit-branch-local)))) + (insert ?\n)))) (defun magit-insert-revision-gravatars (rev beg) (when (and magit-revision-show-gravatars @@ -3041,7 +3100,7 @@ It the SECTION has a different type, then do nothing." (defvar-keymap magit-unstaged-section-map :doc "Keymap for the `unstaged' section." " " #'magit-diff-unstaged - " " #'magit-stage + " " #'magit-stage " " #'magit-discard "<3>" (magit-menu-item "Discard all" #'magit-discard) "<2>" (magit-menu-item "Stage all" #'magit-stage) @@ -3062,7 +3121,7 @@ It the SECTION has a different type, then do nothing." :doc "Keymap for the `staged' section." " " #'magit-reverse " " #'magit-discard - " " #'magit-unstage + " " #'magit-unstage " " #'magit-diff-staged "<4>" (magit-menu-item "Reverse all" #'magit-reverse) "<3>" (magit-menu-item "Discard all" #'magit-discard) @@ -3184,12 +3243,12 @@ actually a `diff' but a `diffstat' section." (and siblings t) (magit-diff-use-hunk-region-p) ssection) - (`(hunk nil t ,_) + (`(hunk nil t ,_) (if (magit-section-internal-region-p section) 'region 'hunk)) - ('(hunk t t nil) 'hunks) - (`(hunk ,_ ,_ ,_) 'hunk) - ('(file t t nil) 'files) - (`(file ,_ ,_ ,_) 'file) + ('(hunk t t nil) 'hunks) + (`(hunk ,_ ,_ ,_) 'hunk) + ('(file t t nil) 'files) + (`(file ,_ ,_ ,_) 'file) ('(module t t nil) 'files) (`(module ,_ ,_ ,_) 'file) (`(,(or 'staged 'unstaged 'untracked) nil ,_ ,_) 'list))))) @@ -3206,159 +3265,52 @@ actually a `diff' but a `diffstat' section." (byte-code-function-p last-command)) (eq (region-end) (region-beginning)))))) -;;; Diff Highlight - -(add-hook 'magit-section-unhighlight-hook #'magit-diff-unhighlight) -(add-hook 'magit-section-highlight-hook #'magit-diff-highlight) - -(defun magit-diff-unhighlight (section selection) - "Remove the highlighting of the diff-related SECTION." - (when (magit-hunk-section-p section) - (magit-diff-paint-hunk section selection nil) - t)) - -(defun magit-diff-highlight (section selection) - "Highlight the diff-related SECTION. -If SECTION is not a diff-related section, then do nothing and -return nil. If SELECTION is non-nil, then it is a list of sections -selected by the region, including SECTION. All of these sections -are highlighted." - (if (and (magit-section-match 'commit section) - (oref section children)) - (progn (if selection - (dolist (section selection) - (magit-diff-highlight-list section selection)) - (magit-diff-highlight-list section)) - t) - (when-let ((scope (magit-diff-scope section t))) - (cond ((eq scope 'region) - (magit-diff-paint-hunk section selection t)) - (selection - (dolist (section selection) - (magit-diff-highlight-recursive section selection))) - (t - (magit-diff-highlight-recursive section))) - t))) - -(defun magit-diff-highlight-recursive (section &optional selection) - (pcase (magit-diff-scope section) - ('list (magit-diff-highlight-list section selection)) - ('file (magit-diff-highlight-file section selection)) - ('hunk (magit-diff-highlight-heading section selection) - (magit-diff-paint-hunk section selection t)) - (_ (magit-section-highlight section nil)))) - -(defun magit-diff-highlight-list (section &optional selection) - (if (oref section children) - (let ((beg (oref section start)) - (cnt (oref section content)) - (end (oref section end))) - (when (or (eq this-command #'mouse-drag-region) - (not selection)) - (unless (and (region-active-p) - (<= (region-beginning) beg)) - (magit-section-make-overlay beg cnt 'magit-section-highlight)) - (if (oref section hidden) - (oset section washer #'ignore) - (dolist (child (oref section children)) - (when (or (eq this-command #'mouse-drag-region) - (not (and (region-active-p) - (<= (region-beginning) - (oref child start))))) - (magit-diff-highlight-recursive child selection))))) - (when magit-diff-highlight-hunk-body - (magit-section-make-overlay (1- end) end 'magit-section-highlight))) - (magit-section-highlight section nil))) - -(defun magit-diff-highlight-file (section &optional selection) - (magit-diff-highlight-heading section selection) - (when (or (not (oref section hidden)) - (cl-typep section 'magit-module-section)) - (dolist (child (oref section children)) - (magit-diff-highlight-recursive child selection)))) - -(defun magit-diff-highlight-heading (section &optional selection) - (magit-section-make-overlay - (oref section start) - (or (oref section content) - (oref section end)) - (pcase (list (oref section type) - (and (member section selection) - (not (eq this-command #'mouse-drag-region)))) - ('(file t) 'magit-diff-file-heading-selection) - ('(file nil) 'magit-diff-file-heading-highlight) - ('(module t) 'magit-diff-file-heading-selection) - ('(module nil) 'magit-diff-file-heading-highlight) - ('(hunk t) 'magit-diff-hunk-heading-selection) - ('(hunk nil) 'magit-diff-hunk-heading-highlight)))) - ;;; Hunk Paint -(cl-defun magit-diff-paint-hunk - (section &optional selection - (highlight (magit-section-selected-p section selection))) - (let (paint) - (unless magit-diff-highlight-hunk-body - (setq highlight nil)) - (cond (highlight - (unless (oref section hidden) - (cl-pushnew section magit-section-highlighted-sections) - (cond ((memq section magit-section-unhighlight-sections) - (setq magit-section-unhighlight-sections - (delq section magit-section-unhighlight-sections))) - (magit-diff-highlight-hunk-body - (setq paint t))))) - (t - (cond ((and (oref section hidden) - (memq section magit-section-unhighlight-sections)) - (cl-pushnew section magit-section-highlighted-sections) - (setq magit-section-unhighlight-sections - (delq section magit-section-unhighlight-sections))) - (t - (setq paint t))))) - (when paint - (save-excursion - (goto-char (oref section start)) - (let ((end (oref section end)) - (merging (looking-at "@@@")) - (diff-type (magit-diff-type)) - (stage nil) - (tab-width (magit-diff-tab-width - (magit-section-parent-value section)))) - (forward-line) - (while (< (point) end) - (when (and magit-diff-hide-trailing-cr-characters - (char-equal ?\r (char-before (line-end-position)))) - (put-text-property (1- (line-end-position)) (line-end-position) - 'invisible t)) - (put-text-property - (point) (1+ (line-end-position)) 'font-lock-face - (cond - ((looking-at "^\\+\\+?\\([<=|>]\\)\\{7\\}") - (setq stage (pcase (list (match-string 1) highlight) - ('("<" nil) 'magit-diff-our) - ('("<" t) 'magit-diff-our-highlight) - ('("|" nil) 'magit-diff-base) - ('("|" t) 'magit-diff-base-highlight) - ('("=" nil) 'magit-diff-their) - ('("=" t) 'magit-diff-their-highlight) - ('(">" nil) nil))) - 'magit-diff-conflict-heading) - ((looking-at (if merging "^\\(\\+\\| \\+\\)" "^\\+")) - (magit-diff-paint-tab merging tab-width) - (magit-diff-paint-whitespace merging 'added diff-type) - (or stage - (if highlight 'magit-diff-added-highlight 'magit-diff-added))) - ((looking-at (if merging "^\\(-\\| -\\)" "^-")) - (magit-diff-paint-tab merging tab-width) - (magit-diff-paint-whitespace merging 'removed diff-type) - (if highlight 'magit-diff-removed-highlight 'magit-diff-removed)) - (t - (magit-diff-paint-tab merging tab-width) - (magit-diff-paint-whitespace merging 'context diff-type) - (if highlight 'magit-diff-context-highlight 'magit-diff-context)))) - (forward-line)))))) - (magit-diff-update-hunk-refinement section)) +(cl-defmethod magit-section-paint ((section magit-hunk-section) highlight) + (unless magit-diff-highlight-hunk-body + (setq highlight nil)) + (let ((end (oref section end)) + (merging (looking-at "@@@")) + (diff-type (magit-diff-type)) + (stage nil) + (tab-width (magit-diff-tab-width + (magit-section-parent-value section)))) + (forward-line) + (while (< (point) end) + (when (and magit-diff-hide-trailing-cr-characters + (char-equal ?\r (char-before (line-end-position)))) + (put-text-property (1- (line-end-position)) (line-end-position) + 'invisible t)) + (put-text-property + (point) (1+ (line-end-position)) 'font-lock-face + (cond + ((looking-at "^\\+\\+?\\([<=|>]\\)\\{7\\}") + (setq stage (pcase (list (match-string 1) highlight) + ('("<" nil) 'magit-diff-our) + ('("<" t) 'magit-diff-our-highlight) + ('("|" nil) 'magit-diff-base) + ('("|" t) 'magit-diff-base-highlight) + ('("=" nil) 'magit-diff-their) + ('("=" t) 'magit-diff-their-highlight) + ('(">" nil) nil))) + 'magit-diff-conflict-heading) + ((looking-at (if merging "^\\(\\+\\| \\+\\)" "^\\+")) + (magit-diff-paint-tab merging tab-width) + (magit-diff-paint-whitespace merging 'added diff-type) + (or stage + (if highlight 'magit-diff-added-highlight 'magit-diff-added))) + ((looking-at (if merging "^\\(-\\| -\\)" "^-")) + (magit-diff-paint-tab merging tab-width) + (magit-diff-paint-whitespace merging 'removed diff-type) + (if highlight 'magit-diff-removed-highlight 'magit-diff-removed)) + (t + (magit-diff-paint-tab merging tab-width) + (magit-diff-paint-whitespace merging 'context diff-type) + (if highlight 'magit-diff-context-highlight 'magit-diff-context)))) + (forward-line))) + (magit-diff-update-hunk-refinement section) + (oset section painted (if highlight 'highlight 'plain))) (defvar magit-diff--tab-width-cache nil) @@ -3411,10 +3363,10 @@ are highlighted." magit-diff-highlight-indentation (setq-local magit-diff-highlight-indentation - (cdr (--first (string-match-p (car it) default-directory) - (nreverse - (default-value - 'magit-diff-highlight-indentation)))))))) + (cdr (seq-find (##string-match-p (car %) default-directory) + (nreverse + (default-value + 'magit-diff-highlight-indentation)))))))) (when (and magit-diff-highlight-trailing (looking-at (concat prefix ".*?\\([ \t]+\\) ?$"))) (let ((ov (make-overlay (match-beginning 1) (match-end 1) nil t))) @@ -3460,7 +3412,6 @@ are highlighted." (recurse child))))) (recurse magit-root-section)))) - ;;; Hunk Region (defun magit-diff-hunk-region-beginning () diff --git a/elpa/magit-20250519.1537/magit-dired.el b/elpa/magit-20250519.1537/magit-dired.el new file mode 100644 index 00000000..5e361ac9 --- /dev/null +++ b/elpa/magit-20250519.1537/magit-dired.el @@ -0,0 +1,109 @@ +;;; magit-dired.el --- Dired support for Magit -*- lexical-binding:t -*- + +;; Copyright (C) 2008-2025 The Magit Project Contributors + +;; Author: Jonas Bernoulli +;; Maintainer: Jonas Bernoulli + +;; SPDX-License-Identifier: GPL-3.0-or-later + +;; 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 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 +;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +;; License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with Magit. If not, see . + +;;; Commentary: + +;; Dired support for Magit. + +;;; Code: + +(require 'magit) + +;; For `magit-do-async-shell-command'. +(declare-function dired-read-shell-command "dired-aux" (prompt arg files)) + +;;; Open Dired from Magit + +;;;###autoload +(defun magit-dired-jump (&optional other-window) + "Visit file at point using Dired. +With a prefix argument, visit in another window. If there +is no file at point, then instead visit `default-directory'." + (interactive "P") + (dired-jump other-window + (and-let* ((file (magit-file-at-point))) + (expand-file-name (if (file-directory-p file) + (file-name-as-directory file) + file))))) + +;;; Commands for Dired Buffers + +;;;###autoload +(defun magit-dired-stage () + "In Dired, staged all marked files or the file at point." + (interactive) + (magit-stage-files (dired-get-marked-files))) + +;;;###autoload +(defun magit-dired-unstage () + "In Dired, unstaged all marked files or the file at point." + (interactive) + (magit-unstage-files (dired-get-marked-files))) + +;;;###autoload +(defun magit-dired-log (&optional follow) + "In Dired, show log for all marked files or the directory if none are marked." + (interactive "P") + (if-let ((topdir (magit-toplevel default-directory))) + (let ((args (car (magit-log-arguments))) + (files (or (dired-get-marked-files nil 'marked) + (list default-directory)))) + (when (and follow + (not (member "--follow" args)) + (not (cdr files))) + (push "--follow" args)) + (magit-log-setup-buffer + (list (or (magit-get-current-branch) "HEAD")) + args + (let ((default-directory topdir)) + (mapcar #'file-relative-name files)) + magit-log-buffer-file-locked)) + (magit--not-inside-repository-error))) + +;;;###autoload +(defun magit-dired-am-apply-patches (repo &optional arg) + "In Dired, apply the marked (or next ARG) files as patches. +If inside a repository, then apply in that. Otherwise prompt +for a repository." + (interactive (list (or (magit-toplevel) + (magit-read-repository t)) + current-prefix-arg)) + (let ((files (dired-get-marked-files nil arg nil nil t))) + (magit-status-setup-buffer repo) + (magit-am-apply-patches files))) + +;;; Miscellaneous Commands + +;;;###autoload +(defun magit-do-async-shell-command (file) + "Open FILE with `dired-do-async-shell-command'. +Interactively, open the file at point." + (interactive (list (or (magit-file-at-point) + (magit-read-file "Act on file")))) + (require 'dired-aux) + (dired-do-async-shell-command + (dired-read-shell-command "& on %s: " current-prefix-arg (list file)) + nil (list file))) + +;;; _ +(provide 'magit-dired) +;;; magit-dired.el ends here diff --git a/elpa/magit-20250107.2324/magit-ediff.el b/elpa/magit-20250519.1537/magit-ediff.el similarity index 99% rename from elpa/magit-20250107.2324/magit-ediff.el rename to elpa/magit-20250519.1537/magit-ediff.el index 650268d8..16e38b78 100644 --- a/elpa/magit-20250107.2324/magit-ediff.el +++ b/elpa/magit-20250519.1537/magit-ediff.el @@ -181,8 +181,8 @@ is put in FILE." (setq get (nreverse get)) (setq make (nreverse make)) (setq kill (nreverse kill)) - (let ((mconf (cl-gensym "conf")) - (mfile (cl-gensym "file"))) + (let ((mconf (gensym "conf")) + (mfile (gensym "file"))) `(magit-with-toplevel (let ((,mconf (current-window-configuration)) (,mfile ,file) @@ -224,8 +224,7 @@ and alternative commands." (let* ((dir (magit-gitdir)) (revA (or (magit-name-branch "HEAD") (magit-commit-p "HEAD"))) - (revB (cl-find-if (lambda (head) - (file-exists-p (expand-file-name head dir))) + (revB (cl-find-if (##file-exists-p (expand-file-name % dir)) '("MERGE_HEAD" "CHERRY_PICK_HEAD" "REVERT_HEAD"))) (revB (or (magit-name-branch revB) (magit-commit-p revB))) @@ -266,7 +265,7 @@ and alternative commands." (save-excursion (goto-char (point-min)) (unless (re-search-forward "^<<<<<<< " nil t) - (magit-stage-file file)))))))) + (magit-stage-files (list file))))))))) (if fileC (magit-ediff-buffers ((magit-get-revision-buffer revA fileA) diff --git a/elpa/magit-20250107.2324/magit-extras.el b/elpa/magit-20250519.1537/magit-extras.el similarity index 92% rename from elpa/magit-20250107.2324/magit-extras.el rename to elpa/magit-20250519.1537/magit-extras.el index 5cc64a38..7e346a68 100644 --- a/elpa/magit-20250107.2324/magit-extras.el +++ b/elpa/magit-20250519.1537/magit-extras.el @@ -28,14 +28,10 @@ (require 'magit) -;; For `magit-do-async-shell-command'. -(declare-function dired-read-shell-command "dired-aux" (prompt arg files)) ;; For `magit-project-status'. (declare-function vc-git-command "vc-git" (buffer okstatus file-or-list &rest flags)) -(defvar ido-exit) -(defvar ido-fallback) (defvar project-prefix-map) (defvar project-switch-commands) @@ -64,7 +60,7 @@ alternative commands." ["Actions" (" m" "Invoke mergetool" magit-git-mergetool)] (interactive - (if (and (not (eq transient-current-prefix 'magit-git-mergetool)) + (if (and (not (eq transient-current-command 'magit-git-mergetool)) current-prefix-arg) (list nil nil t) (list (magit-read-unmerged-file "Resolve") @@ -193,19 +189,6 @@ blame to center around the line point is on." ;;; Emacs Tools -;;;###autoload -(defun ido-enter-magit-status () - "Drop into `magit-status' from file switching. - -To make this command available use something like: - - (keymap-set ido-common-completion-map - \"C-x g\" \\='ido-enter-magit-status)" - (interactive) - (setq ido-exit 'fallback) - (setq ido-fallback #'magit-status) - (exit-minibuffer)) - ;;;###autoload (defun magit-project-status () "Run `magit-status' in the current project's root." @@ -232,62 +215,6 @@ to nil before loading Magit to prevent \"m\" from being bound.") (keymap-set project-prefix-map "m" #'magit-project-status) (add-to-list 'project-switch-commands '(magit-project-status "Magit") t))) -;;;###autoload -(defun magit-dired-jump (&optional other-window) - "Visit file at point using Dired. -With a prefix argument, visit in another window. If there -is no file at point, then instead visit `default-directory'." - (interactive "P") - (dired-jump other-window - (and-let* ((file (magit-file-at-point))) - (expand-file-name (if (file-directory-p file) - (file-name-as-directory file) - file))))) - -;;;###autoload -(defun magit-dired-log (&optional follow) - "Show log for all marked files, or the current file." - (interactive "P") - (if-let ((topdir (magit-toplevel default-directory))) - (let ((args (car (magit-log-arguments))) - (files (dired-get-marked-files nil nil #'magit-file-tracked-p))) - (unless files - (user-error "No marked file is being tracked by Git")) - (when (and follow - (not (member "--follow" args)) - (not (cdr files))) - (push "--follow" args)) - (magit-log-setup-buffer - (list (or (magit-get-current-branch) "HEAD")) - args - (let ((default-directory topdir)) - (mapcar #'file-relative-name files)) - magit-log-buffer-file-locked)) - (magit--not-inside-repository-error))) - -;;;###autoload -(defun magit-dired-am-apply-patches (repo &optional arg) - "In Dired, apply the marked (or next ARG) files as patches. -If inside a repository, then apply in that. Otherwise prompt -for a repository." - (interactive (list (or (magit-toplevel) - (magit-read-repository t)) - current-prefix-arg)) - (let ((files (dired-get-marked-files nil arg nil nil t))) - (magit-status-setup-buffer repo) - (magit-am-apply-patches files))) - -;;;###autoload -(defun magit-do-async-shell-command (file) - "Open FILE with `dired-do-async-shell-command'. -Interactively, open the file at point." - (interactive (list (or (magit-file-at-point) - (magit-read-file "Act on file")))) - (require 'dired-aux) - (dired-do-async-shell-command - (dired-read-shell-command "& on %s: " current-prefix-arg (list file)) - nil (list file))) - ;;; Shift Selection (defun magit--turn-on-shift-select-mode-p () diff --git a/elpa/magit-20250107.2324/magit-fetch.el b/elpa/magit-20250519.1537/magit-fetch.el similarity index 98% rename from elpa/magit-20250107.2324/magit-fetch.el rename to elpa/magit-20250519.1537/magit-fetch.el index 18a2d631..7ef4504b 100644 --- a/elpa/magit-20250107.2324/magit-fetch.el +++ b/elpa/magit-20250519.1537/magit-fetch.el @@ -99,8 +99,8 @@ Otherwise if a remote named \"origin\" exists, then use that. If no remote can be determined, then this command is not available from the `magit-fetch' transient prefix and invoking it directly results in an error." - :if (lambda () (magit-get-current-remote t)) - :description (lambda () (magit-get-current-remote t)) + :if (##magit-get-current-remote t) + :description (##magit-get-current-remote t) (interactive (list (magit-get-current-remote t) (magit-fetch-arguments))) (unless remote diff --git a/elpa/magit-20250107.2324/magit-files.el b/elpa/magit-20250519.1537/magit-files.el similarity index 93% rename from elpa/magit-20250107.2324/magit-files.el rename to elpa/magit-20250519.1537/magit-files.el index 2dbf1189..ed65c0ea 100644 --- a/elpa/magit-20250107.2324/magit-files.el +++ b/elpa/magit-20250519.1537/magit-files.el @@ -210,7 +210,7 @@ is done using `magit-find-index-noselect'." (let ((file (magit-file-relative-name))) (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))) + (if (y-or-n-p (format "Update index with contents of %s?" (buffer-name))) (let ((index (make-temp-name (expand-file-name "magit-update-index-" (magit-gitdir)))) (buffer (current-buffer))) @@ -300,8 +300,10 @@ to `magit-dispatch'." :info-manual "(magit) Minor Mode for Buffers Visiting Files" [:if magit-file-relative-name ["File actions" - (" s" "Stage" magit-stage-buffer-file) - (" u" "Unstage" magit-unstage-buffer-file) + (" s" "Stage" magit-file-stage :if-not-derived dired-mode) + (" s" "Stage" magit-dired-stage :if-derived dired-mode) + (" u" "Unstage" magit-file-unstage :if-not-derived dired-mode) + (" u" "Unstage" magit-dired-unstage :if-derived dired-mode) (", x" "Untrack" magit-file-untrack) (", r" "Rename" magit-file-rename) (", k" "Delete" magit-file-delete) @@ -311,9 +313,10 @@ to `magit-dispatch'." ("d" "Diff" magit-diff-buffer-file)] ["" ("L" "Log..." magit-log) - ("l" "Log" magit-log-buffer-file) + ("l" "Log" magit-log-buffer-file :if-not-derived dired-mode) + ("l" "Log" magit-dired-log :if-derived dired-mode) ("t" "Trace" magit-log-trace-definition) - (7 "M" "Merged" magit-log-merged)] + ("M" "Merged" magit-log-merged :level 7)] ["" ("B" "Blame..." magit-blame) ("b" "Blame" magit-blame-addition) @@ -333,8 +336,8 @@ to `magit-dispatch'." ("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) + ("s" "Stage" magit-stage-files) + ("u" "Unstage" magit-unstage-files) ("x" "Untrack" magit-file-untrack) ("r" "Rename" magit-file-rename) ("k" "Delete" magit-file-delete) @@ -419,6 +422,44 @@ the same location in the respective file in the working tree." ;;; File Commands +;;;###autoload +(defun magit-file-stage () + "Stage all changes to the file being visited in the current buffer." + (interactive) + (unless buffer-file-name + (user-error "Not visiting a file")) + (magit-with-toplevel + (magit-stage-1 (and (magit-file-ignored-p buffer-file-name) + (if (y-or-n-p "Visited file is ignored; stage anyway?") + "--force" + (user-error "Abort"))) + (list (magit-file-relative-name))))) + +;;;###autoload +(defun magit-file-unstage () + "Unstage all changes to the file being visited in the current buffer." + (interactive) + (unless buffer-file-name + (user-error "Not visiting a file")) + (magit-with-toplevel + (magit-unstage-1 (list (magit-file-relative-name))))) + +;;;###autoload +(defun magit-file-untrack (files &optional force) + "Untrack the selected FILES or one file read in the minibuffer. + +With a prefix argument FORCE do so even when the files have +staged as well as unstaged changes." + (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 + (magit-run-git "rm" "--cached" (and force "--force") "--" files))) + +;;;###autoload (defun magit-file-rename (file newname) "Rename or move FILE to NEWNAME. NEWNAME may be a file or directory name. If FILE isn't tracked in @@ -455,20 +496,7 @@ Git, fallback to using `rename-file'." (vc-find-file-hook)))))) (magit-refresh)) -(defun magit-file-untrack (files &optional force) - "Untrack the selected FILES or one file read in the minibuffer. - -With a prefix argument FORCE do so even when the files have -staged as well as unstaged changes." - (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 - (magit-run-git "rm" "--cached" (and force "--force") "--" files))) - +;;;###autoload (defun magit-file-delete (files &optional force) "Delete the selected FILES or one file read in the minibuffer. @@ -556,5 +584,12 @@ If DEFAULT is non-nil, use this as the default value instead of (concat "No file changed in " rev-or-range))) ;;; _ + +(define-obsolete-function-alias 'magit-stage-buffer-file + 'magit-file-stage "Magit 4.3.2") + +(define-obsolete-function-alias 'magit-unstage-buffer-file + 'magit-file-unstage "Magit 4.3.2") + (provide 'magit-files) ;;; magit-files.el ends here diff --git a/elpa/magit-20250107.2324/magit-git.el b/elpa/magit-20250519.1537/magit-git.el similarity index 93% rename from elpa/magit-20250107.2324/magit-git.el rename to elpa/magit-20250519.1537/magit-git.el index c529518a..2e6a14c5 100644 --- a/elpa/magit-20250107.2324/magit-git.el +++ b/elpa/magit-20250519.1537/magit-git.el @@ -150,6 +150,7 @@ option." "-c" "log.showSignature=false" "-c" "color.ui=false" "-c" "color.diff=false" + "-c" "diff.noPrefix=false" ,@(and (eq system-type 'windows-nt) (list "-c" "i18n.logOutputEncoding=UTF-8"))) "Global Git arguments. @@ -165,7 +166,7 @@ anything that is part of the default value, unless you really know what you are doing. And think very hard before adding something; it will be used every time Magit runs Git for any purpose." - :package-version '(magit . "2.9.0") + :package-version '(magit . "4.3.2") :group 'magit-commands :group 'magit-process :type '(repeat string)) @@ -225,7 +226,16 @@ framework ultimately determines how the collection is displayed." ;;; Git -(defvar magit-git-debug nil) +(defvar magit-git-debug nil + "Whether and how to enable additional debugging of git errors. + +Use `magit-toggle-git-debug' (which see) to toggle the boolean value of +this variable. This can also manually be set to `include-success', in +which case successful git invocations are also logged. + +This can also be a function, which takes one argument, the error output +as a string. This is intended for internal use and is established using +let-bindings around critical code (i.e., in `magit--assert-usable-git').") (defun magit-toggle-git-debug () "Toggle whether additional git errors are reported. @@ -234,7 +244,8 @@ Magit basically calls git for one of these two reasons: for side-effects or to do something with its standard output. When git is run for side-effects then its output, including error -messages, go into the process buffer which is shown when using ~$~. +messages, go into the process buffer which is shown when using \ +\\\\[magit-process-buffer]. When git's output is consumed in some way, then it would be too expensive to also insert it into this buffer, but with this command @@ -252,8 +263,8 @@ See info node `(magit)Debugging Tools' for more information." (defmacro magit--with-refresh-cache (key &rest body) (declare (indent 1) (debug (form body))) - (let ((k (cl-gensym)) - (hit (cl-gensym))) + (let ((k (gensym)) + (hit (gensym))) `(if magit--refresh-cache (let ((,k ,key)) (if-let ((,hit (assoc ,k (cdr magit--refresh-cache)))) @@ -299,7 +310,7 @@ propagated by `with-temp-buffer', so we explicitly ensure that happens, so that processes will be invoked consistently. BODY is as for that macro." (declare (indent 0) (debug (body))) - (let ((p (cl-gensym))) + (let ((p (gensym))) `(let ((,p process-environment)) (with-temp-buffer (setq-local process-environment ,p) @@ -452,7 +463,7 @@ a boolean, then raise an error." (defun magit-git-insert (&rest args) "Execute Git with ARGS, insert stdout at point and return exit code. -If `magit-git-debug' in non-nil and the exit code is non-zero, then +If `magit-git-debug' is non-nil and the exit code is non-zero, then insert the run command and stderr into the process buffer." (apply #'magit--git-insert nil args)) @@ -465,7 +476,7 @@ insert the run command and stderr into the process buffer." (setq log (make-temp-file "magit-stderr")) (delete-file log) (setq exit (magit-process-git (list t log) args)) - (when (or (> exit 0) (eq magit-git-debug 'all)) + (when (or (> exit 0) (eq magit-git-debug 'include-success)) (when (file-exists-p log) (with-temp-buffer (insert-file-contents log) @@ -473,7 +484,8 @@ insert the run command and stderr into the process buffer." (setq errmsg (cond ((eq return-error 'full) - (buffer-string)) + (let ((str (buffer-string))) + (and (not (equal str "")) str))) ((functionp magit-git-debug) (funcall magit-git-debug (buffer-string))) ((magit--locate-error-message))))) @@ -497,7 +509,7 @@ insert the run command and stderr into the process buffer." (defun magit--locate-error-message () (goto-char (point-max)) (and (run-hook-wrapped 'magit-process-error-message-regexps - (lambda (re) (re-search-backward re nil t))) + (##re-search-backward % nil t)) (match-string-no-properties 1))) (defun magit-git-string (&rest args) @@ -516,8 +528,8 @@ newline, return an empty string." "Execute Git with ARGS, returning its output as a list of lines. Empty lines anywhere in the output are omitted. -If Git exits with a non-zero exit status, then report show a -message and add a section in the respective process buffer." +If Git exits with a non-zero exit status, show a message and add +a section in the respective process buffer." (magit--with-temp-process-buffer (apply #'magit-git-insert args) (split-string (buffer-string) "\n" t))) @@ -526,24 +538,32 @@ message and add a section in the respective process buffer." "Execute Git with ARGS, returning its null-separated output as a list. Empty items anywhere in the output are omitted. -If Git exits with a non-zero exit status, then report show a -message and add a section in the respective process buffer." +If Git exits with a non-zero exit status, show a message and add +a section in the respective process buffer." (magit--with-temp-process-buffer (apply #'magit-git-insert args) (split-string (buffer-string) "\0" t))) -(defvar magit--git-wash-keep-error t) - (defun magit-git-wash (washer &rest args) - "Execute Git with ARGS, inserting washed output at point. -Actually first insert the raw output at point. If there is no -output, call `magit-cancel-section'. Otherwise temporarily narrow -the buffer to the inserted text, move to its beginning, and then -call function WASHER with ARGS as its sole argument." + "Execute git with ARGS, inserting washed output at point. + +First insert the raw output at point. If there is no output, call +`magit-cancel-section'. Otherwise temporarily narrow the buffer to +the inserted text, move to its beginning, and finally call function +WASHER with ARGS as its sole argument. + +If git exits with a non-zero exit status, apply the `error' face to +the error message, instead of calling WASHER. To instead cancel the +section use `magit--git-wash'." (declare (indent 1)) - (apply #'magit--git-wash washer magit--git-wash-keep-error args)) + (apply #'magit--git-wash washer t args)) (defun magit--git-wash (washer keep-error &rest args) + "Execute git with ARGS, inserting washed output at point. + +Like `magit-git-wash' but if KEEP-ERROR is nil and an error occurs, also +insert standard error. If KEEP-ERROR is `wash-anyway', insert and wash +standard output even in case of an error." (declare (indent 2)) (setq args (flatten-tree args)) (let ((beg (point)) @@ -678,7 +698,7 @@ values of `magit-remote-git-executable' and `exec-path'.\n")) Also include information about `magit-remote-git-executable'. See info node `(magit)Debugging Tools' for more information." (interactive) - (with-current-buffer (get-buffer-create "*magit-git-debug*") + (with-current-buffer (get-buffer-create "*magit-git-executable*") (pop-to-buffer (current-buffer)) (erase-buffer) (insert (format "magit-remote-git-executable: %S\n" @@ -794,7 +814,7 @@ Also see `magit-git-config-p'." (defun magit-git-dir (&optional path) "Like (expand-file-name PATH (magit-gitdir)) or just (magit-gitdir)." - (declare (obsolete 'magit-gitdir "Magit 4.0.0")) + (declare (obsolete magit-gitdir "Magit 4.0.0")) (and-let* ((dir (magit-gitdir))) (if path (expand-file-name (convert-standard-filename path) dir) @@ -1045,19 +1065,16 @@ tracked file." (defun magit-list-files (&rest args) (apply #'magit-git-items "ls-files" "-z" "--full-name" args)) -(defun magit-tracked-files () - (magit-list-files "--cached")) +(defun magit-tracked-files (&rest args) + (magit-list-files "--cached" args)) + +(defun magit-untracked-files (&optional all files &rest args) + (magit-list-files "--other" args + (and (not all) "--exclude-standard") + "--" files)) -(defun magit-untracked-files (&optional all files compact) - (if compact - (--mapcat (and (eq (aref it 0) ??) - (list (substring it 3))) - (magit-git-items "status" "-z" "--porcelain" - (magit-ignore-submodules-p t) - "--" files)) - (magit-list-files "--other" - (and (not all) "--exclude-standard") - "--" files))) +(defun magit-ignored-files (&rest args) + (magit-list-files "--others" "--ignored" "--exclude-standard" args)) (defun magit-modified-files (&optional nomodules files) (magit-git-items "diff-index" "-z" "--name-only" @@ -1078,31 +1095,27 @@ tracked file." (magit-headish) "--" files)) (defun magit-binary-files (&rest args) - (--mapcat (and (string-match "^-\t-\t\\(.+\\)" it) - (list (match-string 1 it))) - (apply #'magit-git-items - "diff" "-z" "--numstat" "--ignore-submodules" - args))) + (mapcan (##and (string-match "^-\t-\t\\(.+\\)" %) + (list (match-string 1 %))) + (apply #'magit-git-items + "diff" "-z" "--numstat" "--ignore-submodules" + args))) (defun magit-unmerged-files () (magit-git-items "diff-files" "-z" "--name-only" "--diff-filter=U")) -(defun magit-ignored-files () - (magit-git-items "ls-files" "-z" "--others" "--ignored" - "--exclude-standard" "--directory")) - (defun magit-stashed-files (stash) (magit-git-items "stash" "show" "-z" "--name-only" stash)) -(defun magit-skip-worktree-files () - (--keep (and (= (aref it 0) ?S) - (substring it 2)) - (magit-list-files "-t"))) +(defun magit-skip-worktree-files (&rest args) + (seq-keep (##and (= (aref % 0) ?S) + (substring % 2)) + (magit-list-files "-t" args))) -(defun magit-assume-unchanged-files () - (--keep (and (memq (aref it 0) '(?h ?s ?m ?r ?c ?k)) - (substring it 2)) - (magit-list-files "-v"))) +(defun magit-assume-unchanged-files (&rest args) + (seq-keep (##and (memq (aref % 0) '(?h ?s ?m ?r ?c ?k)) + (substring % 2)) + (magit-list-files "-v" args))) (defun magit-revision-files (rev) (magit-with-toplevel @@ -1159,21 +1172,23 @@ or if no rename is detected." (defcustom magit-cygwin-mount-points (and (eq system-type 'windows-nt) - (cl-sort (--map (if (string-match "^\\(.*\\) on \\(.*\\) type" it) - (cons (file-name-as-directory (match-string 2 it)) - (file-name-as-directory (match-string 1 it))) - (lwarn '(magit) :error - "Failed to parse Cygwin mount: %S" it)) - ;; If --exec-path is not a native Windows path, - ;; then we probably have a cygwin git. - (let ((process-environment - (append magit-git-environment - process-environment))) - (and (not (string-match-p - "\\`[a-zA-Z]:" - (car (process-lines - magit-git-executable "--exec-path")))) - (ignore-errors (process-lines "mount"))))) + (cl-sort (mapcar + (lambda (mount) + (if (string-match "^\\(.*\\) on \\(.*\\) type" mount) + (cons (file-name-as-directory (match-string 2 mount)) + (file-name-as-directory (match-string 1 mount))) + (lwarn '(magit) :error + "Failed to parse Cygwin mount: %S" mount))) + ;; If --exec-path is not a native Windows path, + ;; then we probably have a cygwin git. + (let ((process-environment + (append magit-git-environment + process-environment))) + (and (not (string-match-p + "\\`[a-zA-Z]:" + (car (process-lines + magit-git-executable "--exec-path")))) + (ignore-errors (process-lines "mount"))))) #'> :key (pcase-lambda (`(,cyg . ,_win)) (length cyg)))) "Alist of (CYGWIN . WIN32) directory names. Sorted from longest to shortest CYGWIN name." @@ -1186,7 +1201,7 @@ Sorted from longest to shortest CYGWIN name." (setq filename (expand-file-name filename))) (if-let ((cyg:win (and (not (file-remote-p default-directory)) ; see #4976 (cl-assoc filename magit-cygwin-mount-points - :test (lambda (f cyg) (string-prefix-p cyg f)))))) + :test (##string-prefix-p %2 %1))))) (concat (cdr cyg:win) (substring filename (length (car cyg:win)))) filename)) @@ -1200,7 +1215,7 @@ Sorted from longest to shortest CYGWIN name." 3. Deal with an `windows-nt' Emacs vs. Cygwin Git incompatibility." (if (file-name-absolute-p filename) (if-let ((cyg:win (cl-rassoc filename magit-cygwin-mount-points - :test (lambda (f win) (string-prefix-p win f))))) + :test (##string-prefix-p %2 %1)))) (concat (car cyg:win) (substring filename (length (cdr cyg:win)))) (let ((expanded (expand-file-name filename))) @@ -1290,8 +1305,7 @@ are considered." (not (magit-module-worktree-p module))) (defun magit-ignore-submodules-p (&optional return-argument) - (or (cl-find-if (lambda (arg) - (string-prefix-p "--ignore-submodules" arg)) + (or (cl-find-if (##string-prefix-p "--ignore-submodules" %) magit-buffer-diff-args) (and-let* ((value (magit-get "diff.ignoreSubmodules"))) (if return-argument @@ -1407,7 +1421,7 @@ Git." (defun magit-rev-fixup-target (rev) (let ((msg (magit-rev-format "%s" rev))) (save-match-data - (and (string-match "\\`\\(fixup\\|squash\\)! \\(.+\\)" msg) + (and (string-match "\\`\\(squash!\\|fixup!\\|amend!\\) \\(.+\\)" msg) (magit-rev-format "%h" (format "%s^{/^%s}" rev (magit--ext-regexp-quote (match-string 2 msg)))))))) @@ -1468,7 +1482,7 @@ If REFNAME is ambiguous, return nil." Return an unambiguous refname, either REFNAME or that prefixed with PREFIX, nil otherwise. If REFNAME has an offset suffix such as \"~1\", then that is preserved. If optional PREFIX is -nil, then use \"heads/\". " +nil, then use \"heads/\"." (if (magit-ref-ambiguous-p refname) (let ((refname (concat (or prefix "heads/") refname))) (and (not (magit-ref-ambiguous-p refname)) refname)) @@ -1509,7 +1523,14 @@ to, or to some other symbolic-ref that points to the same ref." (magit-section-case (branch (oref it value)) (commit (or (magit--painted-branch-at-point) - (magit-name-branch (oref it value)))))) + (magit-name-branch (oref it value)))) + (pullreq (and (fboundp 'forge--pullreq-branch) + (magit-branch-p + (forge--pullreq-branch (oref it value))))) + (related-refs (magit--painted-branch-at-point)) + ((unpulled unpushed) + (magit-ref-abbrev + (replace-regexp-in-string "\\.\\.\\.?" "" (oref it value)))))) (defun magit--painted-branch-at-point (&optional type) (or (and (not (eq type 'remote)) @@ -1628,7 +1649,7 @@ The amount of time spent searching is limited by (defun magit--set-default-branch (newname oldname) (let ((remote (or (magit-primary-remote) (user-error "Cannot determine primary remote"))) - (branches (mapcar (lambda (line) (split-string line "\t")) + (branches (mapcar (##split-string % "\t") (magit-git-lines "for-each-ref" "refs/heads" "--format=%(refname:short)\t%(upstream:short)")))) @@ -1696,15 +1717,20 @@ according to the branch type." 'magit-branch-local 'magit-branch-remote))))) +(defun magit-get-local-upstream-branch (&optional branch) + (and-let* ((upstream (magit-get-upstream-branch branch)) + (upstream (cdr (magit-split-branch-name upstream)))) + (and (magit-branch-p upstream) upstream))) + (defun magit-get-indirect-upstream-branch (branch &optional force) (let ((remote (magit-get "branch" branch "remote"))) (and remote (not (equal remote ".")) ;; The user has opted in... (or force - (--some (if (magit-git-success "check-ref-format" "--branch" it) - (equal it branch) - (string-match-p it branch)) - magit-branch-prefer-remote-upstream)) + (seq-some (##if (magit-git-success "check-ref-format" "--branch" %) + (equal % branch) + (string-match-p % branch)) + magit-branch-prefer-remote-upstream)) ;; and local BRANCH tracks a remote branch... (let ((upstream (magit-get-upstream-branch branch))) ;; whose upstream... @@ -1806,8 +1832,7 @@ exists, then remotes in `magit-primary-remote-names' are tried in order and the first remote from that list that actually exists in the current repository is considered its primary remote." (let ((remotes (magit-list-remotes))) - (seq-find (lambda (name) - (member name remotes)) + (seq-find (##member % remotes) (delete-dups (delq nil (cons (magit-get "magit.primaryRemote") @@ -1872,7 +1897,7 @@ the name of a remote and REF is the ref local to the remote." If optional REV is nil, then default to `HEAD'. If optional WITH-DISTANCE is non-nil then return (TAG COMMITS), -if it is `dirty' return (TAG COMMIT DIRTY). COMMITS is the number +if it is `dirty' return (TAG COMMIT DIRTY). COMMITS is the number of commits in `HEAD' but not in TAG and DIRTY is t if there are uncommitted changes, nil otherwise." (and-let* ((str (magit-git-str "describe" "--long" "--tags" @@ -1924,10 +1949,10 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of (and (not symrefp) value))) (magit-git-lines "for-each-ref" (concat "--format=%(symref) " format) - (--map (concat "--sort=" it) - (pcase (or sortby magit-list-refs-sortby) - ((and val (pred stringp)) (list val)) - ((and val (pred listp)) val))) + (mapcar (##concat "--sort=" %) + (pcase (or sortby magit-list-refs-sortby) + ((and val (pred stringp)) (list val)) + ((and val (pred listp)) val))) (or namespaces magit-list-refs-namespaces)))) (defun magit-list-branches () @@ -1940,16 +1965,16 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of (magit-list-refs (concat "refs/remotes/" remote))) (defun magit-list-related-branches (relation &optional commit &rest args) - (--remove (string-match-p "\\(\\`(HEAD\\|HEAD -> \\)" it) - (--map (substring it 2) - (magit-git-lines "branch" args relation commit)))) + (seq-remove (##string-match-p "\\(\\`(HEAD\\|HEAD -> \\)" %) + (mapcar (##substring % 2) + (magit-git-lines "branch" args relation commit)))) (defun magit-list-containing-branches (&optional commit &rest args) (magit-list-related-branches "--contains" commit args)) (defun magit-list-publishing-branches (&optional commit) - (--filter (magit-rev-ancestor-p (or commit "HEAD") it) - magit-published-branches)) + (seq-filter (##magit-rev-ancestor-p (or commit "HEAD") %) + magit-published-branches)) (defun magit-list-merged-branches (&optional commit &rest args) (magit-list-related-branches "--merged" commit args)) @@ -1958,18 +1983,18 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of (magit-list-related-branches "--no-merged" commit args)) (defun magit-list-unmerged-to-upstream-branches () - (--filter (and-let* ((upstream (magit-get-upstream-branch it))) - (member it (magit-list-unmerged-branches upstream))) - (magit-list-local-branch-names))) + (seq-filter (##and-let* ((upstream (magit-get-upstream-branch %))) + (member % (magit-list-unmerged-branches upstream))) + (magit-list-local-branch-names))) (defun magit-list-branches-pointing-at (commit) (let ((re (format "\\`%s refs/\\(heads\\|remotes\\)/\\(.*\\)\\'" (magit-rev-verify commit)))) - (--keep (and (string-match re it) - (let ((name (match-string 2 it))) - (and (not (string-suffix-p "HEAD" name)) - name))) - (magit-git-lines "show-ref")))) + (seq-keep (##and (string-match re %) + (let ((name (match-string 2 %))) + (and (not (string-suffix-p "HEAD" name)) + name))) + (magit-git-lines "show-ref")))) (defun magit-list-refnames (&optional namespaces include-special) (nconc (magit-list-refs namespaces "%(refname:short)") @@ -1981,8 +2006,7 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of (defun magit-list-special-refnames () (let ((gitdir (magit-gitdir))) - (cl-remove-if-not (lambda (name) - (file-exists-p (expand-file-name name gitdir))) + (cl-remove-if-not (##file-exists-p (expand-file-name % gitdir)) magit-special-refnames))) (defun magit-list-branch-names () @@ -1994,9 +2018,9 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of (defun magit-list-remote-branch-names (&optional remote relative) (if (and remote relative) (let ((regexp (format "^refs/remotes/%s/\\(.+\\)" remote))) - (--mapcat (when (string-match regexp it) - (list (match-string 1 it))) - (magit-list-remote-branches remote))) + (mapcan (##when (string-match regexp %) + (list (match-string 1 %))) + (magit-list-remote-branches remote))) (magit-list-refnames (concat "refs/remotes/" remote)))) (defun magit-format-refs (format &rest args) @@ -2004,7 +2028,7 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of "for-each-ref" (concat "--format=" format) (or args (list "refs/heads" "refs/remotes" "refs/tags"))))) (if (string-search "\f" format) - (--map (split-string it "\f") lines) + (mapcar (##split-string % "\f") lines) lines))) (defun magit-list-remotes () @@ -2023,41 +2047,40 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of (magit-get-all "notes.displayRef"))) (defun magit-list-notes-refnames () - (--map (substring it 6) (magit-list-refnames "refs/notes"))) + (mapcar (##substring % 6) (magit-list-refnames "refs/notes"))) (defun magit-remote-list-tags (remote) - (--keep (and (not (string-suffix-p "^{}" it)) - (substring it 51)) - (magit-git-lines "ls-remote" "--tags" remote))) + (seq-keep (##and (not (string-suffix-p "^{}" %)) + (substring % 51)) + (magit-git-lines "ls-remote" "--tags" remote))) (defun magit-remote-list-branches (remote) - (--keep (and (not (string-suffix-p "^{}" it)) - (substring it 52)) - (magit-git-lines "ls-remote" "--heads" remote))) + (seq-keep (##and (not (string-suffix-p "^{}" %)) + (substring % 52)) + (magit-git-lines "ls-remote" "--heads" remote))) (defun magit-remote-list-refs (remote) - (--keep (and (not (string-suffix-p "^{}" it)) - (substring it 41)) - (magit-git-lines "ls-remote" remote))) + (seq-keep (##and (not (string-suffix-p "^{}" %)) + (substring % 41)) + (magit-git-lines "ls-remote" remote))) (defun magit-remote-head (remote) (and-let* ((line (cl-find-if - (lambda (line) - (string-match - "\\`ref: refs/heads/\\([^\s\t]+\\)[\s\t]HEAD\\'" line)) + (##string-match + "\\`ref: refs/heads/\\([^\s\t]+\\)[\s\t]HEAD\\'" %) (magit-git-lines "ls-remote" "--symref" remote "HEAD")))) (match-string 1 line))) (defun magit-list-modified-modules () - (--keep (and (string-match "\\`\\+\\([^ ]+\\) \\(.+\\) (.+)\\'" it) - (match-string 2 it)) - (magit-git-lines "submodule" "status"))) + (seq-keep (##and (string-match "\\`\\+\\([^ ]+\\) \\(.+\\) (.+)\\'" %) + (match-string 2 %)) + (magit-git-lines "submodule" "status"))) (defun magit-list-module-paths () (magit-with-toplevel - (--mapcat (and (string-match "^160000 [0-9a-z]\\{40,\\} 0\t\\(.+\\)$" it) - (list (match-string 1 it))) - (magit-git-items "ls-files" "-z" "--stage")))) + (mapcan (##and (string-match "^160000 [0-9a-z]\\{40,\\} 0\t\\(.+\\)$" %) + (list (match-string 1 %))) + (magit-git-items "ls-files" "-z" "--stage")))) (defun magit-list-module-names () (mapcar #'magit-get-submodule-name (magit-list-module-paths))) @@ -2181,8 +2204,7 @@ exists, then the branch names in `magit-main-branch-names' are tried in order. The first branch from that list that actually exists in the current repository is considered its main branch." (let ((branches (magit-list-local-branch-names))) - (seq-find (lambda (name) - (member name branches)) + (seq-find (##member % branches) (delete-dups (delq nil (cons (magit-get "init.defaultBranch") @@ -2229,13 +2251,12 @@ If `first-parent' is set, traverse only first parents." (magit-rev-parse (magit-abbrev-arg "short") rev)) (defun magit-commit-children (commit &optional args) - (mapcar #'car - (--filter (member commit (cdr it)) - (--map (split-string it " ") - (magit-git-lines - "log" "--format=%H %P" - (or args (list "--branches" "--tags" "--remotes")) - "--not" commit))))) + (seq-keep (lambda (line) + (pcase-let ((`(,child . ,parents) (split-string line " "))) + (and (member commit parents) child))) + (magit-git-lines "log" "--format=%H %P" + (or args (list "--branches" "--tags" "--remotes")) + "--not" commit))) (defun magit-commit-parents (commit) (and-let* ((str (magit-git-string "rev-list" "-1" "--parents" commit))) @@ -2308,8 +2329,8 @@ and this option only controls what face is used.") ", " t)) state head upstream tags branches remotes other combined) (dolist (ref refs) - (let* ((face (cdr (--first (string-match (car it) ref) - magit-ref-namespaces))) + (let* ((face (cdr (seq-find (##string-match (car %) ref) + magit-ref-namespaces))) (name (match-string 1 ref)) (name (if (and name (not (string-prefix-p "refs/tags/" ref)) @@ -2402,7 +2423,7 @@ and this option only controls what face is used.") (defmacro magit-with-temp-index (tree arg &rest body) (declare (indent 2) (debug (form form body))) - (let ((file (cl-gensym "file"))) + (let ((file (gensym "file"))) `(let ((magit--refresh-cache nil) (,file (magit-convert-filename-for-git (make-temp-name @@ -2421,7 +2442,7 @@ and this option only controls what face is used.") (defun magit-commit-tree (message &optional tree &rest parents) (magit-git-string "commit-tree" "--no-gpg-sign" "-m" message - (--mapcat (list "-p" it) (delq nil parents)) + (mapcan (##list "-p" %) (delq nil parents)) (or tree (magit-git-string "write-tree") (error "Cannot write tree")))) @@ -2529,9 +2550,8 @@ and this option only controls what face is used.") (string-match-p "[a-z]" string) (magit-commit-p string)) (and (magit-ref-p string) - (let ((face (get-text-property (point) 'face))) - (or (not face) - (member face magit-revision-faces))))) + (member (get-text-property (point) 'face) + magit-revision-faces))) string))))) (put 'git-revision-range 'thing-at-point #'magit-thingatpt--git-revision-range) @@ -2624,8 +2644,8 @@ and this option only controls what face is used.") (cl-union (and local-branch (if remote (list local-branch) - (--map (concat it "/" local-branch) - (magit-list-remotes)))) + (mapcar (##concat % "/" local-branch) + (magit-list-remotes)))) (magit-list-remote-branch-names remote t) :test #'equal) nil require-match nil 'magit-revision-history default))) @@ -2720,7 +2740,7 @@ and this option only controls what face is used.") (or (magit-section-value-if 'branch) atpoint (and (not (cdr atrev)) (car atrev)) - (--first (not (equal it current)) atrev) + (seq-find (##not (equal % current)) atrev) (magit-get-previous-branch) (car atrev))))) diff --git a/elpa/magit-20250107.2324/magit-gitignore.el b/elpa/magit-20250519.1537/magit-gitignore.el similarity index 94% rename from elpa/magit-20250107.2324/magit-gitignore.el rename to elpa/magit-20250519.1537/magit-gitignore.el index 14ce4307..0ee63df0 100644 --- a/elpa/magit-20250107.2324/magit-gitignore.el +++ b/elpa/magit-20250519.1537/magit-gitignore.el @@ -42,10 +42,9 @@ ("p" "privately (.git/info/exclude)" magit-gitignore-in-gitdir) ("g" magit-gitignore-on-system - :if (lambda () (magit-get "core.excludesfile")) - :description (lambda () - (format "privately for all repositories (%s)" - (magit-get "core.excludesfile"))))] + :if (##magit-get "core.excludesfile") + :description (##format "privately for all repositories (%s)" + (magit-get "core.excludesfile")))] ["Skip worktree" (7 "w" "do skip worktree" magit-skip-worktree) (7 "W" "do not skip worktree" magit-no-skip-worktree)] @@ -116,11 +115,12 @@ Rules that are defined in that file affect all local repositories." (base (and base (file-directory-p base) base)) (choices (delete-dups - (--mapcat - (cons (concat "/" it) - (and-let* ((ext (file-name-extension it))) - (list (concat "/" (file-name-directory it) "*." ext) - (concat "*." ext)))) + (mapcan + (lambda (file) + (cons (concat "/" file) + (and-let* ((ext (file-name-extension file))) + (list (concat "/" (file-name-directory file) "*." ext) + (concat "*." ext))))) (sort (nconc (magit-untracked-files nil base) ;; The untracked section of the status buffer lists diff --git a/elpa/magit-20250107.2324/magit-log.el b/elpa/magit-20250519.1537/magit-log.el similarity index 89% rename from elpa/magit-20250107.2324/magit-log.el rename to elpa/magit-20250519.1537/magit-log.el index 6c015991..3c4ac21d 100644 --- a/elpa/magit-20250107.2324/magit-log.el +++ b/elpa/magit-20250519.1537/magit-log.el @@ -31,6 +31,7 @@ (require 'magit-core) (require 'magit-diff) +(declare-function magit--any-wip-mode-enabled-p "magit-wip" ()) (declare-function magit-blob-visit "magit-files" (blob-or-file)) (declare-function magit-cherry-apply "magit-sequence" (commit &optional args)) (declare-function magit-insert-head-branch-header "magit-status" @@ -57,11 +58,11 @@ (make-obsolete-variable 'magit-log-highlight-keywords 'magit-log-wash-summary-hook - "Magit 4.2.1") + "Magit 4.3.0") (make-obsolete-variable 'magit-log-format-message-function 'magit-log-wash-summary-hook - "Magit 4.2.1") + "Magit 4.3.0") ;;; Options ;;;; Log Mode @@ -163,7 +164,7 @@ called, point is at the beginning of the buffer. See also the related `magit-revision-wash-message-hook'. You likely want to use the same functions for both hooks." - :package-version '(magit . "4.2.1") + :package-version '(magit . "4.3.0") :group 'magit-log :type 'hook :options (list #'magit-highlight-squash-markers @@ -173,9 +174,9 @@ want to use the same functions for both hooks." "Function used to generate text shown in header line of log buffers." :package-version '(magit . "2.12.0") :group 'magit-log - :type '(choice (function-item magit-log-header-line-arguments) - (function-item magit-log-header-line-sentence) - function)) + :type `(radio (function-item ,#'magit-log-header-line-arguments) + (function-item ,#'magit-log-header-line-sentence) + function)) (defcustom magit-log-trace-definition-function #'magit-which-function "Function used to determine the function at point. @@ -184,10 +185,10 @@ You should prefer `magit-which-function' over `which-function' because the latter may make use of Imenu's outdated cache." :package-version '(magit . "3.0.0") :group 'magit-log - :type '(choice (function-item magit-which-function) - (function-item which-function) - (function-item add-log-current-defun) - function)) + :type `(radio (function-item ,#'magit-which-function) + (function-item ,#'which-function) + (function-item ,#'add-log-current-defun) + function)) (defcustom magit-log-color-graph-limit 256 "Number of commits over which log graphs are not colored. @@ -262,10 +263,10 @@ The message can be shown in the `echo-area' or the `header-line', or in be nil, in which case no usage information is shown." :package-version '(magit . "2.1.0") :group 'magit-log - :type '(choice (const :tag "in echo-area" echo-area) - (const :tag "in header-line" header-line) - (const :tag "in both places" both) - (const :tag "nowhere"))) + :type '(choice (const :tag "In echo-area" echo-area) + (const :tag "In header-line" header-line) + (const :tag "In both places" both) + (const :tag "Nowhere"))) (defcustom magit-log-select-margin (list (nth 0 magit-log-margin) @@ -376,12 +377,12 @@ commits before and half after." (when-let (((not (eq transient-current-command 'magit-dispatch))) (file (magit-file-relative-name))) (setq files (list file))) - (oset obj value (if files `(("--" ,@files) ,args) args)))) + (oset obj value (if files `(("--" ,@files) ,@args) args)))) (cl-defmethod transient-init-value ((obj magit-log-refresh-prefix)) (oset obj value (if magit-buffer-log-files `(("--" ,@magit-buffer-log-files) - ,magit-buffer-log-args) + ,@magit-buffer-log-args) magit-buffer-log-args))) (cl-defmethod transient-set-value ((obj magit-log-prefix)) @@ -442,89 +443,92 @@ commits before and half after." ;;; Commands ;;;; Prefix Commands -(eval-and-compile - (defvar magit-log-infix-arguments - ;; The grouping in git-log(1) appears to be guided by implementation - ;; details, so our logical grouping only follows it to an extend. - ;; Arguments that are "misplaced" here: - ;; 1. From "Commit Formatting". - ;; 2. From "Common Diff Options". - ;; 3. From unnamed first group. - ;; 4. Implemented by Magit. - [:class transient-subgroups - ["Commit limiting" - (magit-log:-n) - (magit:--author) - (7 magit-log:--since) - (7 magit-log:--until) - (magit-log:--grep) - (7 "-i" "Search case-insensitive" ("-i" "--regexp-ignore-case")) - (7 "-I" "Invert search pattern" "--invert-grep") - (magit-log:-G) ;2 - (magit-log:-S) ;2 - (magit-log:-L) ;2 - (7 "=m" "Omit merges" "--no-merges") - (7 "=p" "First parent" "--first-parent")] - ["History simplification" - ( "-D" "Simplify by decoration" "--simplify-by-decoration") - (magit:--) - ( "-f" "Follow renames when showing single-file log" "--follow") ;3 - (6 "/s" "Only commits changing given paths" "--sparse") - (7 "/d" "Only selected commits plus meaningful history" "--dense") - (7 "/a" "Only commits existing directly on ancestry path" "--ancestry-path") - (6 "/f" "Do not prune history" "--full-history") - (7 "/m" "Prune some history" "--simplify-merges")] - ["Commit ordering" - (magit-log:--*-order) - ("-r" "Reverse order" "--reverse")] - ["Formatting" - ("-g" "Show graph" "--graph") ;1 - ("-c" "Show graph in color" "--color") ;2 - ("-d" "Show refnames" "--decorate") ;3 - ("=S" "Show signatures" "--show-signature") ;1 - ("-h" "Show header" "++header") ;4 - ("-p" "Show diffs" ("-p" "--patch")) ;2 - ("-s" "Show diffstats" "--stat")] ;2 - ])) +(transient-define-group magit-log-infix-arguments + ;; The grouping in git-log(1) appears to be guided by implementation + ;; details, so our logical grouping only follows it to an extend. + ;; Arguments that are "misplaced" here: + ;; 1. From "Commit Formatting". + ;; 2. From "Common Diff Options". + ;; 3. From unnamed first group. + ;; 4. Implemented by Magit. + ["Commit limiting" + :if magit-log-infix-arguments--show-p + (magit-log:-n) + (magit:--author) + (7 magit-log:--since) + (7 magit-log:--until) + (magit-log:--grep) + (7 "-i" "Search case-insensitive" ("-i" "--regexp-ignore-case")) + (7 "-I" "Invert search pattern" "--invert-grep") + (magit-log:-G) ;2 + (magit-log:-S) ;2 + (magit-log:-L) ;2 + (7 "=m" "Omit merges" "--no-merges") + (7 "=p" "First parent" "--first-parent")] + ["History simplification" + :if magit-log-infix-arguments--show-p + ( "-D" "Simplify by decoration" "--simplify-by-decoration") + (magit:--) + ( "-f" "Follow renames when showing single-file log" "--follow") ;3 + (6 "/s" "Only commits changing given paths" "--sparse") + (7 "/d" "Only selected commits plus meaningful history" "--dense") + (7 "/a" "Only commits existing directly on ancestry path" "--ancestry-path") + (6 "/f" "Do not prune history" "--full-history") + (7 "/m" "Prune some history" "--simplify-merges")] + ["Commit ordering" + :if magit-log-infix-arguments--show-p + (magit-log:--*-order) + ("-r" "Reverse order" "--reverse")] + ["Formatting" + :if magit-log-infix-arguments--show-p + ("-g" "Show graph" "--graph") ;1 + ("-c" "Show graph in color" "--color") ;2 + ("-d" "Show refnames" "--decorate") ;3 + ("=S" "Show signatures" "--show-signature") ;1 + ("-h" "Show header" "++header") ;4 + ("-p" "Show diffs" ("-p" "--patch")) ;2 + ("-s" "Show diffstats" "--stat")]) ;2 + +(defun magit-log-infix-arguments--show-p () + (if (eq (oref (transient-prefix-object) command) 'magit-log-refresh) + (eq major-mode 'magit-log-mode) + t)) ;;;###autoload (autoload 'magit-log "magit-log" nil t) (transient-define-prefix magit-log () "Show a commit or reference log." :man-page "git-log" :class 'magit-log-prefix - [magit-log-infix-arguments] + 'magit-log-infix-arguments [["Log" - ("l" "current" magit-log-current) - ("h" "HEAD" magit-log-head) - ("u" "related" magit-log-related) - ("o" "other" magit-log-other)] + ("l" magit-log-current) + ("o" "other" magit-log-other) + ("h" "HEAD" magit-log-head :level 0) + ("u" "related" magit-log-related)] ["" - ("L" "local branches" magit-log-branches) - ("b" "all branches" magit-log-all-branches) - ("a" "all references" magit-log-all) - (7 "B" "matching branches" magit-log-matching-branches) - (7 "T" "matching tags" magit-log-matching-tags) - (7 "m" "merged" magit-log-merged)] + ("L" "local branches" magit-log-branches) + ("b" "all branches" magit-log-all-branches) + ("a" "all references" magit-log-all) + ("B" "matching branches" magit-log-matching-branches :level 7) + ("T" "matching tags" magit-log-matching-tags :level 7) + ("m" "merged" magit-log-merged :level 7)] ["Reflog" - ("r" "current" magit-reflog-current) - ("H" "HEAD" magit-reflog-head) - ("O" "other" magit-reflog-other)] - [:if (lambda () - (and (fboundp 'magit--any-wip-mode-enabled-p) - (magit--any-wip-mode-enabled-p))) + ("r" "current" magit-reflog-current) + ("O" "other" magit-reflog-other) + ("H" "HEAD" magit-reflog-head)] + [:if magit--any-wip-mode-enabled-p :description "Wiplog" - ("i" "index" magit-wip-log-index) - ("w" "worktree" magit-wip-log-worktree)] + ("i" "index" magit-wip-log-index) + ("w" "worktree" magit-wip-log-worktree)] ["Other" - (5 "s" "shortlog" magit-shortlog)]]) + ("s" "shortlog" magit-shortlog)]]) ;;;###autoload (autoload 'magit-log-refresh "magit-log" nil t) (transient-define-prefix magit-log-refresh () "Change the arguments used for the log(s) in the current buffer." :man-page "git-log" :class 'magit-log-refresh-prefix - [:if-mode magit-log-mode - magit-log-infix-arguments] + magit-log-infix-arguments [:if-not-mode magit-log-mode :description "Arguments" (magit-log:-n) @@ -652,14 +656,13 @@ commits before and half after." "Read a string from the user to pass as parameter to OPTION." (magit-read-string (format "Type a pattern to pass to %s" option))) -;;;###autoload -(defun magit-log-current (revs &optional args files) - "Show log for the current branch. -When `HEAD' is detached or with a prefix argument show log for -one or more revs read from the minibuffer." - (interactive (cons (magit-log-read-revs t) - (magit-log-arguments))) - (magit-log-setup-buffer revs args files)) +;;;###autoload (autoload 'magit-log-current "magit-log" nil t) +(transient-define-suffix magit-log-current (&optional args files) + "Show log for the current branch, or `HEAD' if no branch is checked out." + :description (##if (magit-get-current-branch) "current" "HEAD") + (interactive (magit-log-arguments)) + (magit-log-setup-buffer (list (or (magit-get-current-branch) "HEAD")) + args files)) ;;;###autoload (defun magit-log-head (&optional args files) @@ -883,7 +886,7 @@ limit. Otherwise set it to 256." (defun magit-log-set-commit-limit (fn) (let* ((val magit-buffer-log-args) - (arg (--first (string-match "^-n\\([0-9]+\\)?$" it) val)) + (arg (seq-find (##string-match "^-n\\([0-9]+\\)?$" %) val)) (num (and arg (string-to-number (match-string 1 arg)))) (num (if num (funcall fn num 2) 256))) (setq val (remove arg val)) @@ -894,8 +897,8 @@ limit. Otherwise set it to 256." (magit-refresh)) (defun magit-log-get-commit-limit (&optional args) - (and-let* ((str (--first (string-match "^-n\\([0-9]+\\)?$" it) - (or args magit-buffer-log-args)))) + (and-let* ((str (seq-find (##string-match "^-n\\([0-9]+\\)?$" %) + (or args magit-buffer-log-args)))) (string-to-number (match-string 1 str)))) ;;;; Mode Commands @@ -925,9 +928,8 @@ is displayed in the current frame." (let* ((section (magit-current-section)) (parent-rev (format "%s^%s" (oref section value) (or n 1)))) (if-let ((parent-hash (magit-rev-parse "--short" parent-rev))) - (if-let ((parent (--first (equal (oref it value) - parent-hash) - (magit-section-siblings section 'next)))) + (if-let ((parent (seq-find (##equal (oref % value) parent-hash) + (magit-section-siblings section 'next)))) (magit-section-goto parent) (user-error (substitute-command-keys @@ -1009,6 +1011,59 @@ of the current repository first; creating it if necessary." (transient-args 'magit-shortlog))) (magit-git-shortlog rev-or-range args)) +;;;; Movement Commands + +(defvar magit-reference-movement-faces + '(magit-tag + magit-branch-remote + magit-branch-remote-head + magit-branch-local + magit-branch-current + magit-branch-upstream + magit-branch-warning + magit-head + magit-refname + magit-refname-stash + magit-refname-wip + magit-refname-pullreq)) + +(defvar-keymap magit-reference-navigation-repeat-map + :repeat t + "p" #'magit-previous-reference + "n" #'magit-next-reference + "r" #'magit-next-reference) + +(defun magit-previous-reference () + "Move to the previous Git reference appearing in the current buffer. + +Move to the previous location that uses a face appearing in +`magit-reference-movement-faces'. If `repeat-mode' is enabled, +this command and its counterpart can be repeated using \ +\\\ +\\[magit-previous-reference] and \\[magit-next-reference]." + (interactive) + (magit-next-reference t)) + +(defun magit-next-reference (&optional previous) + "Move to the next Git reference appearing in the current buffer. + +Move to the next location that uses a face appearing in +`magit-reference-movement-faces'. If `repeat-mode' is enabled, +this command and its counterpart can be repeated using \ +\\\ +\\[magit-previous-reference] and \\[magit-next-reference]." + (interactive) + (catch 'found + (let ((pos (point))) + (while (and (not (eobp)) + (setq pos (if previous + (previous-single-property-change pos 'face) + (next-single-property-change pos 'face)))) + (when (cl-intersection (ensure-list (get-text-property pos 'face)) + magit-reference-movement-faces) + (throw 'found (goto-char pos)))) + (message "No more references")))) + ;;; Log Mode (defvar magit-log-disable-graph-hack-args @@ -1074,9 +1129,8 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. (unless (length= files 1) (setq args (remove "--follow" args))) (when (and (car magit-log-remove-graph-args) - (--any-p (string-match-p - (concat "^" (regexp-opt magit-log-remove-graph-args)) it) - args)) + (let ((re (concat "^" (regexp-opt magit-log-remove-graph-args)))) + (seq-some (##string-match-p re %) args))) (setq args (remove "--graph" args))) (setq args (magit-log--maybe-drop-color-graph args limit)) (when-let* ((limit limit) @@ -1088,16 +1142,15 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. (not (member revs '("--all" "--branches"))) (not (seq-some (lambda (arg) - (--any-p (string-prefix-p it arg) - magit-log-disable-graph-hack-args)) + (seq-some (##string-prefix-p % arg) + magit-log-disable-graph-hack-args)) args)) (magit-git-string "rev-list" "--count" "--first-parent" args revs)))) (setq revs (if (< (string-to-number count) limit) revs (format "%s~%s..%s" revs limit revs)))) - (let ((delay (cl-find-if (lambda (arg) - (member arg '("++header" "--patch" "--stat"))) + (let ((delay (cl-find-if (##member % '("++header" "--patch" "--stat")) args))) (setq magit-section-inhibit-markers (if delay 'delay t)) (setq magit-section-insert-in-reverse (not delay))) @@ -1130,10 +1183,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. (defun magit-log-header-line-arguments (revs args files) "Return string describing some of the used arguments." - (mapconcat (lambda (arg) - (if (string-search " " arg) - (prin1 arg) - arg)) + (mapconcat (##if (string-search " " %) (prin1 %) %) `("git" "log" ,@args ,@revs "--" ,@files) " ")) @@ -1145,9 +1195,9 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. " in reverse") (and files (concat " touching " (string-join files " "))) - (--some (and (string-prefix-p "-L" it) - (concat " " it)) - args))) + (seq-some (##and (string-prefix-p "-L" %) + (concat " " %)) + args))) (defun magit-insert-log (revs &optional args files) (declare (obsolete magit--insert-log "Magit 4.0.0")) @@ -1191,8 +1241,8 @@ Do not add this to a hook variable." (concat "\n" magit-log-revision-headers-format "\n")) "")) (progn - (when-let ((order (--first (string-match "^\\+\\+order=\\(.+\\)$" it) - args))) + (when-let ((order (seq-find (##string-match "^\\+\\+order=\\(.+\\)$" %) + args))) (setq args (cons (format "--%s-order" (match-string 1 order)) (remove order args)))) (when (member "--decorate" args) @@ -1403,15 +1453,11 @@ Do not add this to a hook variable." (setq date (+ (string-to-number (match-string 1 date)) (* (string-to-number (match-string 2 date)) 60 60) (* (string-to-number (match-string 3 date)) 60)))) - (save-excursion - (backward-char) - (magit-log-format-margin hash author date))) + (magit-log-format-margin hash author date)) (when (and (eq style 'cherry) (magit-buffer-margin-p)) - (save-excursion - (backward-char) - (apply #'magit-log-format-margin hash - (split-string (magit-rev-format "%aN%x00%ct" hash) "\0")))) + (apply #'magit-log-format-margin hash + (split-string (magit-rev-format "%aN%x00%ct" hash) "\0"))) (when (and graph (not (eobp)) (not (looking-at non-graph-re))) @@ -1442,8 +1488,8 @@ Do not add this to a hook variable." (while (and (not (eobp)) (not (looking-at non-graph-re))) (when align (save-excursion (insert align))) - (magit-make-margin-overlay) - (forward-line)) + (forward-line) + (magit-make-margin-overlay)) ;; When `--format' is used and its value isn't one of the ;; predefined formats, then `git-log' does not insert a ;; separator line. @@ -1518,10 +1564,10 @@ If there is no blob buffer in the same frame, then do nothing." (defun magit--maybe-update-blob-buffer () (when-let* ((commit (magit-section-value-if 'commit)) - (buffer (--first (with-current-buffer it - (eq revert-buffer-function - 'magit-revert-rev-file-buffer)) - (mapcar #'window-buffer (window-list))))) + (buffer (seq-find (##with-current-buffer % + (eq revert-buffer-function + 'magit-revert-rev-file-buffer)) + (mapcar #'window-buffer (window-list))))) (if magit--update-blob-buffer (setq magit--update-blob-buffer (list commit buffer)) (setq magit--update-blob-buffer (list commit buffer)) @@ -1540,8 +1586,8 @@ If there is no blob buffer in the same frame, then do nothing." (defun magit-log-goto-commit-section (rev) (let ((abbrev (magit-rev-format "%h" rev))) - (when-let ((section (--first (equal (oref it value) abbrev) - (oref magit-root-section children)))) + (when-let ((section (seq-find (##equal (oref % value) abbrev) + (oref magit-root-section children)))) (goto-char (oref section start))))) (defun magit-log-goto-same-commit () @@ -1571,7 +1617,7 @@ The shortstat style is experimental and rather slow." (magit-log-format-shortstat-margin rev) (magit-log-format-author-margin author date)))) -(defun magit-log-format-author-margin (author date &optional previous-line) +(defun magit-log-format-author-margin (author date) (pcase-let ((`(,_ ,style ,width ,details ,details-width) (or magit-buffer-margin (symbol-value (magit-margin-option)) @@ -1596,8 +1642,7 @@ The shortstat style is experimental and rather slow." (format (format (if abbr "%%2d%%-%dc" "%%2d %%-%ds") (- width (if details (1+ details-width) 0))) cnt unit))) - 'magit-log-date)) - previous-line))) + 'magit-log-date))))) (defun magit-log-format-shortstat-margin (rev) (magit-make-margin-overlay @@ -1633,9 +1678,9 @@ The shortstat style is experimental and rather slow." (if (eq style 'age-abbreviated) 1 ; single character (+ 1 ; gap after digits - (apply #'max (--map (max (length (nth 1 it)) - (length (nth 2 it))) - magit--age-spec))))))))) + (apply #'max (mapcar (##max (length (nth 1 %)) + (length (nth 2 %))) + magit--age-spec))))))))) ;;; Select Mode @@ -1703,7 +1748,7 @@ Type \\[magit-log-select-quit] to abort without selecting a commit." (if initial (magit-log-goto-commit-section initial) (while-let ((rev (magit-section-value-if 'commit)) - ((string-match-p "\\`\\(fixup\\|squash\\)!" + ((string-match-p "\\`\\(squash!\\|fixup!\\|amend!\\)" (magit-rev-format "%s" rev))) (section (magit-current-section)) (next (car (magit-section-siblings section 'next)))) @@ -1833,11 +1878,11 @@ keymap is the parent of their keymaps." "<1>" (magit-menu-item "Visit diff" #'magit-diff-dwim)) (cl-defmethod magit-section-ident-value ((section magit-unpulled-section)) - "\"..@{push}\" cannot be used as the value because that is -ambiguous if `push.default' does not allow a 1:1 mapping, and -many commands would fail because of that. But here that does -not matter and we need an unique value so we use that string -in the pushremote case." + "Return \"..@{push}\". +\"..@{push}\" cannot be used as the value because that is ambiguous +if `push.default' does not allow a 1:1 mapping, and many commands +would fail because of that. But here that does not matter and we +need an unique value, so we use that string in the pushremote case." (let ((value (oref section value))) (if (equal value "..@{upstream}") value "..@{push}"))) @@ -1874,11 +1919,11 @@ in the pushremote case." (magit-log-insert-child-count)))) (cl-defmethod magit-section-ident-value ((section magit-unpushed-section)) - "\"..@{push}\" cannot be used as the value because that is -ambiguous if `push.default' does not allow a 1:1 mapping, and -many commands would fail because of that. But here that does -not matter and we need an unique value so we use that string -in the pushremote case." + "Return \"..@{push}\". +\"..@{push}\" cannot be used as the value because that is ambiguous +if `push.default' does not allow a 1:1 mapping, and many commands +would fail because of that. But here that does not matter and we +need an unique value, so we use that string in the pushremote case." (let ((value (oref section value))) (if (equal value "@{upstream}..") value "@{push}.."))) @@ -1933,8 +1978,8 @@ Show the last `magit-log-section-commit-count' commits." (magit--insert-log nil (and (member "--graph" magit-buffer-log-args) range) (cons (format "-n%d" magit-log-section-commit-count) - (--remove (string-prefix-p "-n" it) - magit-buffer-log-args)))))) + (seq-remove (##string-prefix-p "-n" %) + magit-buffer-log-args)))))) (magit-define-section-jumper magit-jump-to-unpushed-to-pushremote "Unpushed to " unpushed "@{push}.." diff --git a/elpa/magit-20250107.2324/magit-margin.el b/elpa/magit-20250519.1537/magit-margin.el similarity index 94% rename from elpa/magit-20250107.2324/magit-margin.el rename to elpa/magit-20250519.1537/magit-margin.el index f2abe52b..b710fbdd 100644 --- a/elpa/magit-20250107.2324/magit-margin.el +++ b/elpa/magit-20250519.1537/magit-margin.el @@ -159,15 +159,16 @@ does not carry to other options." (and (magit-buffer-margin-p) (nth 2 magit-buffer-margin)))))) -(defun magit-make-margin-overlay (&optional string previous-line) - (if previous-line - (save-excursion - (forward-line -1) - (magit-make-margin-overlay string)) +(cl-defun magit-make-margin-overlay (&optional string (previous-line nil sline)) + "Display STRING in the margin of the previous (or current) line. +If point is at the beginning of a line, set the margin string for +the previous line, otherwise for the current line. Semi-obsolete +optional PREVIOUS-LINE can be used to explicitly specify which +line is affected." + (save-excursion + (forward-line (if (if sline previous-line (bolp)) -1 0)) ;; Don't put the overlay on the complete line to work around #1880. - (let ((o (make-overlay (1+ (line-beginning-position)) - (line-end-position) - nil t))) + (let ((o (make-overlay (1+ (point)) (line-end-position) nil t))) (overlay-put o 'evaporate t) (overlay-put o 'before-string (propertize "o" 'display @@ -177,13 +178,14 @@ does not carry to other options." (defvar magit-margin-overlay-conditions '( unpulled unpushed recent stashes local cherries [remote branchbuf] + [shelved branchbuf] [tags branchbuf] topics issues pullreqs)) (defun magit-maybe-make-margin-overlay () (when (magit-section-match magit-margin-overlay-conditions magit-insert-section--current) - (magit-make-margin-overlay nil t))) + (magit-make-margin-overlay))) ;;; Custom Support diff --git a/elpa/magit-20250107.2324/magit-merge.el b/elpa/magit-20250519.1537/magit-merge.el similarity index 95% rename from elpa/magit-20250107.2324/magit-merge.el rename to elpa/magit-20250519.1537/magit-merge.el index af687c6a..4dc003ff 100644 --- a/elpa/magit-20250107.2324/magit-merge.el +++ b/elpa/magit-20250519.1537/magit-merge.el @@ -47,7 +47,8 @@ (5 "-b" "Ignore changes in amount of whitespace" "-Xignore-space-change") (5 "-w" "Ignore whitespace when comparing lines" "-Xignore-all-space") (5 magit-diff:--diff-algorithm :argument "-Xdiff-algorithm=") - (5 magit:--gpg-sign)] + (magit:--gpg-sign) + (magit:--signoff)] ["Actions" :if-not magit-merge-in-progress-p [("m" "Merge" magit-merge-plain) @@ -57,7 +58,7 @@ [("p" "Preview merge" magit-merge-preview) "" ("s" "Squash merge" magit-merge-squash) - ("i" "Dissolve" magit-merge-into)]] + ("d" "Dissolve" magit-merge-dissolve)]] ["Actions" :if magit-merge-in-progress-p ("m" "Commit merge" magit-commit-create) @@ -128,7 +129,7 @@ inspect the merge and change the commit message. (magit-run-git-async "merge" "--no-commit" args rev)) ;;;###autoload -(defun magit-merge-into (branch &optional args) +(defun magit-merge-dissolve (branch &optional args) "Merge the current branch into BRANCH and remove the former. Before merging, force push the source branch to its push-remote, @@ -138,14 +139,11 @@ obsolete version of the commits that are being merged. Finally if `forge-branch-pullreq' was used to create the merged branch, then also remove the respective remote branch." (interactive - (list (magit-read-other-local-branch - (format "Merge `%s' into" - (or (magit-get-current-branch) - (magit-rev-parse "HEAD"))) - nil - (and-let* ((upstream (magit-get-upstream-branch)) - (upstream (cdr (magit-split-branch-name upstream)))) - (and (magit-branch-p upstream) upstream))) + (list (let ((branch (magit-get-current-branch))) + (magit-read-other-local-branch + (format "Merge `%s' into" (or branch (magit-rev-parse "HEAD"))) + nil + (and branch (magit-get-local-upstream-branch branch)))) (magit-merge-arguments))) (let ((current (magit-get-current-branch)) (head (magit-rev-parse "HEAD"))) @@ -168,7 +166,7 @@ then also remove the respective remote branch." (magit-merge-arguments))) (magit--merge-absorb branch args)) -(defun magit--merge-absorb (branch args) +(defun magit--merge-absorb (branch args &optional message) (when (equal branch (magit-main-branch)) (unless (yes-or-no-p (format "Do you really want to merge `%s' into another branch? " @@ -185,7 +183,9 @@ then also remove the respective remote branch." (magit-process-sentinel process event) (process-put process 'inhibit-refresh t) (magit-process-sentinel process event) - (magit--merge-absorb-1 branch args)))))) + (magit--merge-absorb-1 branch args)) + (when message + (message message)))))) (magit--merge-absorb-1 branch args))) (defun magit--merge-absorb-1 (branch args) diff --git a/elpa/magit-20250107.2324/magit-mode.el b/elpa/magit-20250519.1537/magit-mode.el similarity index 91% rename from elpa/magit-20250107.2324/magit-mode.el rename to elpa/magit-20250519.1537/magit-mode.el index baf35f88..34af2422 100644 --- a/elpa/magit-20250107.2324/magit-mode.el +++ b/elpa/magit-20250519.1537/magit-mode.el @@ -123,12 +123,12 @@ All Magit buffers (buffers whose major-modes derive from which in turn uses the function specified here." :package-version '(magit . "2.3.0") :group 'magit-buffers - :type '(radio (function-item magit-display-buffer-traditional) - (function-item magit-display-buffer-same-window-except-diff-v1) - (function-item magit-display-buffer-fullframe-status-v1) - (function-item magit-display-buffer-fullframe-status-topleft-v1) - (function-item magit-display-buffer-fullcolumn-most-v1) - (function-item display-buffer) + :type `(radio (function-item ,#'magit-display-buffer-traditional) + (function-item ,#'magit-display-buffer-same-window-except-diff-v1) + (function-item ,#'magit-display-buffer-fullframe-status-v1) + (function-item ,#'magit-display-buffer-fullframe-status-topleft-v1) + (function-item ,#'magit-display-buffer-fullcolumn-most-v1) + (function-item ,#'display-buffer) (function :tag "Function"))) (defcustom magit-pre-display-buffer-hook @@ -153,7 +153,7 @@ which in turn uses the function specified here." "The function used to generate the name for a Magit buffer." :package-version '(magit . "2.3.0") :group 'magit-buffers - :type '(radio (function-item magit-generate-buffer-name-default-function) + :type `(radio (function-item ,#'magit-generate-buffer-name-default-function) (function :tag "Function"))) (defcustom magit-buffer-name-format "%x%M%v: %t%x" @@ -202,9 +202,9 @@ support additional %-sequences." "The function used to bury or kill the current Magit buffer." :package-version '(magit . "3.2.0") :group 'magit-buffers - :type '(radio (function-item quit-window) - (function-item magit-mode-quit-window) - (function-item magit-restore-window-configuration) + :type `(radio (function-item ,#'quit-window) + (function-item ,#'magit-mode-quit-window) + (function-item ,#'magit-restore-window-configuration) (function :tag "Function"))) (defcustom magit-prefix-use-buffer-arguments 'selected @@ -234,10 +234,10 @@ and Buffer Variables'." :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) - (const :tag "use args from buffer if it is current" current) - (const :tag "never use args from buffer" never))) + (const :tag "Always use args from buffer" always) + (const :tag "Use args from buffer if displayed in frame" selected) + (const :tag "Use args from buffer if it is current" current) + (const :tag "Never use args from buffer" never))) (defcustom magit-direct-use-buffer-arguments 'selected "Whether certain commands reuse arguments active in relevant buffer. @@ -267,10 +267,10 @@ and Buffer Variables'." :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) - (const :tag "use args from buffer if it is current" current) - (const :tag "never use args from buffer" never))) + (const :tag "Always use args from buffer" always) + (const :tag "Use args from buffer if displayed in frame" selected) + (const :tag "Use args from buffer if it is current" current) + (const :tag "Never use args from buffer" never))) (defcustom magit-region-highlight-hook '(magit-diff-update-hunk-region) ; from magit-diff.el @@ -398,11 +398,11 @@ recommended value." ":" 'magit-git-command "r" 'magit-rebase "R" 'magit-file-rename - "s" 'magit-stage-file + "s" 'magit-stage-files "S" 'magit-stage-modified "t" 'magit-tag "T" 'magit-notes - "u" 'magit-unstage-file + "u" 'magit-unstage-files "U" 'magit-unstage-all "v" 'magit-revert-no-commit "V" 'magit-revert @@ -419,6 +419,7 @@ recommended value." "!" 'magit-run ">" 'magit-sparse-checkout "C-c C-c" 'magit-dispatch + "C-c C-r" 'magit-next-reference "C-c C-e" 'magit-edit-thing "C-c C-o" 'magit-browse-thing "C-c C-w" 'magit-copy-thing @@ -493,7 +494,7 @@ to the kill ring." 'bug-reference-push-button)) (easy-menu-define magit-mode-menu magit-mode-map - "Magit menu" + "Magit menu." ;; Similar to `magit-dispatch' but exclude: ;; - commands that are available from context menus: ;; apply, reverse, discard, stage, unstage, @@ -569,7 +570,7 @@ Magit is documented in info node `(magit)'." (magit-hack-dir-local-variables) (face-remap-add-relative 'header-line 'magit-header-line) (setq mode-line-process (magit-repository-local-get 'mode-line-process)) - (setq-local revert-buffer-function #'magit-refresh-buffer) + (setq-local revert-buffer-function #'magit-revert-buffer) (setq-local bookmark-make-record-function #'magit--make-bookmark) (setq-local imenu-create-index-function #'magit--imenu-create-index) (setq-local imenu-default-goto-function #'magit--imenu-goto-function) @@ -661,7 +662,7 @@ The buffer's major-mode should derive from `magit-section-mode'." (magit-display-buffer buffer) (with-current-buffer buffer (run-hooks 'magit-setup-buffer-hook) - (magit-refresh-buffer) + (magit-refresh-buffer created) (when created (run-hooks 'magit-post-create-buffer-hook))) buffer)) @@ -834,10 +835,10 @@ into thinking a buffer belongs to a repo that it doesn't.") (defun magit-mode-get-buffers () (let ((topdir (magit-toplevel))) - (--filter (with-current-buffer it - (and (derived-mode-p 'magit-mode) - (equal magit--default-directory topdir))) - (buffer-list)))) + (seq-filter (##with-current-buffer % + (and (derived-mode-p 'magit-mode) + (equal magit--default-directory topdir))) + (buffer-list)))) (defvar-local magit-buffer-locked-p nil) (put 'magit-buffer-locked-p 'permanent-local t) @@ -888,17 +889,7 @@ If a frame, then only consider buffers on that frame." (setq magit--default-directory default-directory) (setq magit-buffer-locked-p (and value t)) (magit-restore-section-visibility-cache mode)) - (when magit-uniquify-buffer-names - (cl-pushnew mode uniquify-list-buffers-directory-modes) - (with-current-buffer buffer - (setq list-buffers-directory (abbreviate-file-name default-directory))) - (let ((uniquify-buffer-name-style - (if (memq uniquify-buffer-name-style '(nil forward)) - 'post-forward-angle-brackets - uniquify-buffer-name-style))) - (uniquify-rationalize-file-buffer-names - name (file-name-directory (directory-file-name default-directory)) - buffer))) + (magit--maybe-uniquify-buffer-names buffer name mode) buffer)) (defun magit-generate-buffer-name-default-function (mode &optional value) @@ -921,6 +912,19 @@ account." (?t . ,n) (?x . ,(if magit-uniquify-buffer-names "" "*")))))) +(defun magit--maybe-uniquify-buffer-names (buffer name mode) + (when magit-uniquify-buffer-names + (cl-pushnew mode uniquify-list-buffers-directory-modes) + (with-current-buffer buffer + (setq list-buffers-directory (abbreviate-file-name default-directory))) + (let ((uniquify-buffer-name-style + (if (memq uniquify-buffer-name-style '(nil forward)) + 'post-forward-angle-brackets + uniquify-buffer-name-style))) + (uniquify-rationalize-file-buffer-names + name (file-name-directory (directory-file-name default-directory)) + buffer)))) + ;;; Buffer Lock (defun magit-toggle-buffer-lock () @@ -946,16 +950,25 @@ latter is displayed in its place." (switch-to-buffer unlocked nil t) (kill-buffer locked)) (setq magit-buffer-locked-p nil) - (rename-buffer (funcall magit-generate-buffer-name-function - major-mode))) + (let ((name (funcall magit-generate-buffer-name-function major-mode)) + (buffer (current-buffer)) + (mode major-mode)) + (rename-buffer (generate-new-buffer-name name)) + (with-temp-buffer + (magit--maybe-uniquify-buffer-names buffer name mode)))) (if-let ((value (magit-buffer-value))) (if-let ((locked (magit-get-mode-buffer major-mode value))) (let ((unlocked (current-buffer))) (switch-to-buffer locked nil t) (kill-buffer unlocked)) (setq magit-buffer-locked-p t) - (rename-buffer (funcall magit-generate-buffer-name-function - major-mode value))) + (let ((name (funcall magit-generate-buffer-name-function + major-mode value)) + (buffer (current-buffer)) + (mode major-mode)) + (rename-buffer (generate-new-buffer-name name)) + (with-temp-buffer + (magit--maybe-uniquify-buffer-names buffer name mode)))) (user-error "Buffer has no value it could be locked to")))) ;;; Bury Buffer @@ -983,14 +996,14 @@ current buffer is the last remaining Magit buffer that was ever displayed in the selected window, then delete that window." (if (or (one-window-p) - (--first (let ((buffer (car it))) - (and (not (eq buffer (current-buffer))) - (buffer-live-p buffer) - (or (not (window-parameter nil 'magit-dedicated)) - (with-current-buffer buffer - (derived-mode-p 'magit-mode - 'magit-process-mode))))) - (window-prev-buffers))) + (seq-find (pcase-lambda (`(,buffer)) + (and (not (eq buffer (current-buffer))) + (buffer-live-p buffer) + (or (not (window-parameter nil 'magit-dedicated)) + (with-current-buffer buffer + (derived-mode-p 'magit-mode + 'magit-process-mode))))) + (window-prev-buffers))) (quit-window kill-buffer) (let ((window (selected-window))) (quit-window kill-buffer) @@ -1007,7 +1020,8 @@ window." Refresh the current buffer if its major mode derives from `magit-mode', and refresh the corresponding status buffer. -Run hooks `magit-pre-refresh-hook' and `magit-post-refresh-hook'." +Run hooks `magit-pre-refresh-hook', `magit-post-refresh-hook' +and `magit-unwind-refresh-hook'." (interactive) (unless magit-inhibit-refresh (unwind-protect @@ -1049,15 +1063,18 @@ Run hooks `magit-pre-refresh-hook' and `magit-post-refresh-hook'." (with-current-buffer buffer (magit-refresh-buffer))) (magit-run-hook-with-benchmark 'magit-post-refresh-hook)) -(defvar-local magit-refresh-start-time nil) +(defvar-local magit--refresh-start-time nil) -(defun magit-refresh-buffer (&rest _ignore) +(defvar magit--initial-section-hook nil) + +(defun magit-refresh-buffer (&optional created) "Refresh the current Magit buffer." (interactive) - (setq magit-refresh-start-time (current-time)) - (let ((refresh (intern (format "%s-refresh-buffer" - (substring (symbol-name major-mode) 0 -5)))) - (magit--refresh-cache (or magit--refresh-cache (list (cons 0 0))))) + (let ((magit--refreshing-buffer-p t) + (magit--refresh-start-time (current-time)) + (magit--refresh-cache (or magit--refresh-cache (list (cons 0 0)))) + (refresh (intern (format "%s-refresh-buffer" + (substring (symbol-name major-mode) 0 -5))))) (when (functionp refresh) (when magit-refresh-verbose (message "Refreshing buffer `%s'..." (buffer-name))) @@ -1080,8 +1097,8 @@ Run hooks `magit-pre-refresh-hook' and `magit-post-refresh-hook'." (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-unhighlight-sections nil) (let ((inhibit-read-only t)) (erase-buffer) (save-excursion @@ -1093,12 +1110,22 @@ Run hooks `magit-pre-refresh-hook' and `magit-post-refresh-hook'." (with-current-buffer buffer (let ((magit-section-movement-hook nil)) (apply #'magit-section-goto-successor args))))) + (when created + (run-hooks 'magit--initial-section-hook) + (setq-local magit--initial-section-hook nil)) + (let ((magit-section-cache-visibility nil)) + (magit-section-show magit-root-section)) (run-hooks 'magit-refresh-buffer-hook) (magit-section-update-highlight) - (set-buffer-modified-p nil)) + (set-buffer-modified-p nil) + (push buffer magit-section--refreshed-buffers)) (when magit-refresh-verbose (message "Refreshing buffer `%s'...done (%.3fs)" (buffer-name) - (float-time (time-since magit-refresh-start-time))))))) + (float-time (time-since magit--refresh-start-time))))))) + +(defun magit-revert-buffer (_ignore-auto _noconfirm) + "Wrapper around `magit-refresh-buffer' suitable as `revert-buffer-function'." + (magit-refresh-buffer)) (defun magit-profile-refresh-buffer () "Profile refreshing the current Magit buffer." @@ -1118,9 +1145,8 @@ Run hooks `magit-pre-refresh-hook' and `magit-post-refresh-hook'." (interactive) (require (quote elp)) (cond ((catch 'in-progress - (mapatoms (lambda (symbol) - (and (get symbol elp-timer-info-property) - (throw 'in-progress t))))) + (mapatoms (##and (get % elp-timer-info-property) + (throw 'in-progress t)))) (message "Stop profiling and display results...") (elp-results) (elp-restore-all)) @@ -1141,12 +1167,13 @@ Run hooks `magit-pre-refresh-hook' and `magit-post-refresh-hook'." (defvar magit-after-save-refresh-buffers nil) (defun magit-after-save-refresh-buffers () - (dolist (buffer magit-after-save-refresh-buffers) - (when (buffer-live-p buffer) - (with-current-buffer buffer - (magit-refresh-buffer)))) - (setq magit-after-save-refresh-buffers nil) - (remove-hook 'post-command-hook #'magit-after-save-refresh-buffers)) + (unless magit-inhibit-refresh + (dolist (buffer magit-after-save-refresh-buffers) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (magit-refresh-buffer)))) + (setq magit-after-save-refresh-buffers nil) + (remove-hook 'post-command-hook #'magit-after-save-refresh-buffers))) (defun magit-after-save-refresh-status () "Refresh the status buffer of the current repository. @@ -1195,14 +1222,12 @@ argument (the prefix) non-nil means save all with no questions." (when-let ((topdir (magit-rev-parse-safe "--show-toplevel"))) (let ((remote (file-remote-p default-directory)) (save-some-buffers-action-alist - `((?Y (lambda (buffer) - (with-current-buffer buffer - (setq buffer-save-without-query t) - (save-buffer))) + `((?Y (##with-current-buffer % + (setq buffer-save-without-query t) + (save-buffer)) "to save the current buffer and remember choice") - (?N (lambda (buffer) - (with-current-buffer buffer - (setq magit-inhibit-refresh-save t))) + (?N (##with-current-buffer % + (setq magit-inhibit-refresh-save t)) "to skip the current buffer and remember choice") ,@save-some-buffers-action-alist)) (topdirs nil) @@ -1329,6 +1354,7 @@ Later, when the buffer is buried, it may be restored by 'help-echo (purecopy "mouse-2, RET: go back to next history entry")) (defvar magit-xref-modes + ;; Do not function-quote to avoid circular dependencies. '(magit-log-mode magit-reflog-mode magit-diff-mode @@ -1424,7 +1450,7 @@ repositories." (defmacro magit--with-repository-local-cache (key &rest body) (declare (indent 1) (debug (form body))) - (let ((k (cl-gensym))) + (let ((k (gensym))) `(let ((,k ,key)) (if-let ((kv (magit-repository-local-exists-p ,k))) (cdr kv) diff --git a/elpa/magit-20250107.2324/magit-notes.el b/elpa/magit-20250519.1537/magit-notes.el similarity index 97% rename from elpa/magit-20250107.2324/magit-notes.el rename to elpa/magit-20250519.1537/magit-notes.el index 64bf977a..0b262158 100644 --- a/elpa/magit-20250107.2324/magit-notes.el +++ b/elpa/magit-20250519.1537/magit-notes.el @@ -192,8 +192,8 @@ Also see `magit-notes-merge'." (defun magit-notes-read-args (prompt) (list (magit-read-branch-or-commit prompt (magit-stash-at-point)) - (and-let* ((str (--first (string-match "^--ref=\\(.+\\)" it) - (transient-args 'magit-notes)))) + (and-let* ((str (seq-find (##string-match "^--ref=\\(.+\\)" %) + (transient-args 'magit-notes)))) (match-string 1 str)))) ;;; _ diff --git a/elpa/magit-20250107.2324/magit-patch.el b/elpa/magit-20250519.1537/magit-patch.el similarity index 98% rename from elpa/magit-20250107.2324/magit-patch.el rename to elpa/magit-20250519.1537/magit-patch.el index 4c6bba86..88641d51 100644 --- a/elpa/magit-20250107.2324/magit-patch.el +++ b/elpa/magit-20250519.1537/magit-patch.el @@ -40,12 +40,12 @@ a constant list of arguments, depending on this option and the prefix argument." :package-version '(magit . "2.12.0") :group 'magit-diff - :type '(choice (const :tag "use buffer arguments" buffer) - (cons :tag "use buffer arguments except" + :type '(choice (const :tag "Use buffer arguments" buffer) + (cons :tag "Use buffer arguments except" (const :format "" exclude) (repeat :format "%v%i\n" (string :tag "Argument"))) - (repeat :tag "use constant arguments" + (repeat :tag "Use constant arguments" (string :tag "Argument")))) ;;; Commands diff --git a/elpa/magit-20250107.2324/magit-pkg.el b/elpa/magit-20250519.1537/magit-pkg.el similarity index 68% rename from elpa/magit-20250107.2324/magit-pkg.el rename to elpa/magit-20250519.1537/magit-pkg.el index 1b162469..3a09fdd3 100644 --- a/elpa/magit-20250107.2324/magit-pkg.el +++ b/elpa/magit-20250519.1537/magit-pkg.el @@ -1,16 +1,16 @@ ;; -*- no-byte-compile: t; lexical-binding: nil -*- -(define-package "magit" "20250107.2324" +(define-package "magit" "20250519.1537" "A Git porcelain inside Emacs." '((emacs "27.1") - (compat "30.0.1.0") - (dash "2.19.1") - (magit-section "4.2.0") + (compat "30.1.0.0") + (llama "0.6.2") + (magit-section "4.3.5") (seq "2.24") - (transient "0.8.2") + (transient "0.8.8") (with-editor "3.4.3")) :url "https://github.com/magit/magit" - :commit "8b6bb7c7e88c298e1447ca7c86138588a3953784" - :revdesc "8b6bb7c7e88c" + :commit "9b81df36b4eb6d2443632cb44c67acd8ea1f366f" + :revdesc "9b81df36b4eb" :keywords '("git" "tools" "vc") :authors '(("Marius Vollmer" . "marius.vollmer@gmail.com") ("Jonas Bernoulli" . "emacs.magit@jonas.bernoulli.dev")) diff --git a/elpa/magit-20250107.2324/magit-process.el b/elpa/magit-20250519.1537/magit-process.el similarity index 93% rename from elpa/magit-20250107.2324/magit-process.el rename to elpa/magit-20250519.1537/magit-process.el index 91c90def..2a4083ed 100644 --- a/elpa/magit-20250107.2324/magit-process.el +++ b/elpa/magit-20250519.1537/magit-process.el @@ -41,6 +41,12 @@ (defvar messages-buffer-name) (defvar y-or-n-p-map) +(define-obsolete-variable-alias 'magit-process-finish-apply-ansi-colors + 'magit-process-apply-ansi-colors "Magit-Section 4.3.2") + +(defclass magit-process-section (magit-section) + ((process :initform nil))) + ;;; Options (defcustom magit-process-connection-type (not (eq system-type 'cygwin)) @@ -49,8 +55,8 @@ If nil, use pipes: this is usually more efficient, and works on Cygwin. If t, use ptys: this enables Magit to prompt for passphrases when needed." :group 'magit-process - :type '(choice (const :tag "pipe" nil) - (const :tag "pty" t))) + :type '(choice (const :tag "Pipe" nil) + (const :tag "Pty" t))) (defcustom magit-need-cygwin-noglob (and (eq system-type 'windows-nt) @@ -106,21 +112,20 @@ displays the text of `magit-process-error-summary' instead." integer)) (defcustom magit-credential-cache-daemon-socket - (--some (pcase-let ((`(,prog . ,args) (split-string it))) - (if (and prog + (seq-some (lambda (line) + (pcase-let ((`(,prog . ,args) (split-string line))) + (and prog (string-match-p - "\\`\\(?:\\(?:/.*/\\)?git-credential-\\)?cache\\'" prog)) - (or (cl-loop for (opt val) on args - if (string= opt "--socket") - return val) - (expand-file-name "~/.git-credential-cache/socket")))) - ;; Note: `magit-process-file' is not yet defined when - ;; evaluating this form, so we use `process-lines'. - (ignore-errors - (let ((process-environment - (append magit-git-environment process-environment))) - (process-lines magit-git-executable - "config" "--get-all" "credential.helper")))) + "\\`\\(?:\\(?:/.*/\\)?git-credential-\\)?cache\\'" prog) + (or (cadr (member "--socket" args)) + (expand-file-name "~/.git-credential-cache/socket"))))) + ;; Note: `magit-process-file' is not yet defined when + ;; evaluating this form, so we use `process-lines'. + (ignore-errors + (let ((process-environment + (append magit-git-environment process-environment))) + (process-lines magit-git-executable + "config" "--get-all" "credential.helper")))) "If non-nil, start a credential cache daemon using this socket. When using Git's cache credential helper in the normal way, Emacs @@ -144,33 +149,41 @@ itself from the hook, to avoid further futile attempts." (const :tag "Don't start a cache daemon" nil))) (defcustom magit-process-yes-or-no-prompt-regexp - (concat " [([]" - "\\([Yy]\\(?:es\\)?\\)" - "[/|]" - "\\([Nn]o?\\)" - ;; OpenSSH v8 prints this. See #3969. - "\\(?:/\\[fingerprint\\]\\)?" - "[])] ?[?:]? ?$") + (eval-when-compile + (concat " [([]" + "\\([Yy]\\(?:es\\)?\\)" + "[/|]" + "\\([Nn]o?\\)" + ;; OpenSSH v8 prints this. See #3969. + "\\(?:/\\[fingerprint\\]\\)?" + "[])] ?[?:]? ?$")) "Regexp matching Yes-or-No prompts of Git and its subprocesses." :package-version '(magit . "2.1.0") :group 'magit-process :type 'regexp) (defcustom magit-process-password-prompt-regexps - '("^\\(Enter \\)?[Pp]assphrase\\( for \\(RSA \\)?key '.*'\\)?: ?$" - ;; Match-group 99 is used to identify the "user@host" part. - "^\\(Enter \\|([^) ]+) \\)?\ -[Pp]assword\\( for '?\\(https?://\\)?\\(?99:[^']+\\)'?\\)?: ?$" - "Please enter the passphrase for the ssh key" - "Please enter the passphrase to unlock the OpenPGP secret key" + ;; See also history in test `magit-process:password-prompt-regexps'. + '(;; * CLI-prompt for passphrase for key: + "^\\(\\(Please e\\|E\\)nter \\(the \\)?p\\|P\\)assphrase.*: ?$" + ;; * Password for something other than a host: + "^\\(\\(Please e\\|E\\)nter \\(the \\)?p\\|P\\)assword: ?$" + ;; * Password for [user@]host (which we put in match group 99): + "^\\(\\(Please e\\|E\\)nter \\(the \\)?p\\|P\\)assword for \ +[\"']?\\(https?://\\)?\\(?99:[^\"']+\\)[\"']?: ?$" + "^(\\(?1:[^) ]+\\)) Password for \\(?99:\\1\\): ?$" ;#4992 "^\\(?99:[^']+\\)\\('s\\)? password: ?$" - "^.+ password: ?$" - "^Token: $" ; For git-credential-manager-core (#4318). + ;; * Token for git-credential-manager-core (#4318): + "^Token: ?$" + ;; * Secret for card: "^Yubikey for .*: ?$" - "^Enter PIN for .*: ?$") + "^Enter PIN for .*: ?$" + ;; * Unanchored TUI-prompt for passphrase for key: + "Please enter the passphrase for the ssh key" + "Please enter the passphrase to unlock the OpenPGP secret key") "List of regexps matching password prompts of Git and its subprocesses. Also see `magit-process-find-password-functions'." - :package-version '(magit . "3.0.0") + :package-version '(magit . "4.3.0") :group 'magit-process :type '(repeat (regexp))) @@ -241,6 +254,24 @@ implement such functions." :group 'magit-process :type 'boolean) +(defcustom magit-process-apply-ansi-colors nil + "Whether and when to apply color escapes in the process buffer. + +Magit instructs Git to not colorize its output, but third-party Git +hooks may do so anyway. We recommend you figure out how to prevent +such hooks from colorizing their output instead of customizing this +option. + +If `nil' (the default), do not apply color escape sequences. If `t', +apply them once the subprocess has finished. If `filter', apply them +as input arrives (which is more expensive and potentially fragile). +This is a footgun; starter-kits should leave this option untouched." + :package-version '(magit . "4.3.2") + :group 'magit-process + :type '(choice (const :tag "Do not apply" nil) + (const :tag "Apply when subprocess has finished" t) + (const :tag "Apply using process filter" filter))) + (defcustom magit-process-timestamp-format nil "Format of timestamp for each process in the process buffer. If non-nil, pass this to `format-time-string' when creating a @@ -248,7 +279,7 @@ process section in the process buffer, and insert the returned string in the heading of its section." :package-version '(magit . "4.0.0") :group 'magit-process - :type '(choice (const :tag "none" nil) string)) + :type '(choice (const :tag "None" nil) string)) (defvar tramp-pipe-stty-settings) (defvar magit-tramp-pipe-stty-settings "" @@ -328,10 +359,10 @@ optional NODISPLAY is non-nil also display it." (while (not (equal topdir prev)) (setq prev topdir) (setq topdir (file-name-directory (directory-file-name topdir))))))) - (let ((buffer (or (--first (with-current-buffer it - (and (eq major-mode 'magit-process-mode) - (equal default-directory topdir))) - (buffer-list)) + (let ((buffer (or (seq-find (##with-current-buffer % + (and (eq major-mode 'magit-process-mode) + (equal default-directory topdir))) + (buffer-list)) (magit-generate-new-buffer 'magit-process-mode nil topdir)))) (with-current-buffer buffer @@ -539,11 +570,10 @@ current when this function was called (if it is a Magit buffer and still alive), as well as the respective Magit status buffer. See `magit-start-process' for more information." - (let ((message-log-max nil)) - (message "Running %s %s" (magit-git-executable) + (magit-msg "Running %s %s" (magit-git-executable) (let ((m (string-join (flatten-tree args) " "))) (remove-list-of-text-properties 0 (length m) '(face) m) - m))) + m)) (magit-start-git nil args)) (defun magit-run-git-with-editor (&rest args) @@ -697,9 +727,6 @@ Magit status buffer." ;;; Process Internals -(defclass magit-process-section (magit-section) - ((process :initform nil))) - (setf (alist-get 'process magit--section-type-alist) 'magit-process-section) (defun magit-process-setup (program args) @@ -835,6 +862,8 @@ Magit status buffer." (setq string (substring string (1+ ret-pos))) (delete-region (line-beginning-position) (point))) (setq string (magit-process-remove-bogus-errors string)) + (when (eq magit-process-apply-ansi-colors 'filter) + (setq string (ansi-color-apply string))) (insert (propertize string 'magit-section (process-get proc 'section))) (set-marker (process-mark proc) (point)) @@ -915,7 +944,7 @@ respective documentation. After manually editing ~/.authinfo.gpg you must reset the cache using - M-x auth-source-forget-all-cached RET + \\`M-x' `auth-source-forget-all-cached' \\`RET' The above will save you from having to repeatedly type your token or password, but you might still repeatedly @@ -991,8 +1020,8 @@ from the user." (defun magit-process-match-prompt (prompts string) "Match STRING against PROMPTS and set match data. -Return the matched string suffixed with \": \", if needed." - (when (--any-p (string-match it string) prompts) +Return the matched string, appending \": \" if needed." + (when (seq-some (##string-match % string) prompts) (let ((prompt (match-string 0 string))) (cond ((string-suffix-p ": " prompt) prompt) ((string-suffix-p ":" prompt) (concat prompt " ")) @@ -1024,12 +1053,13 @@ as argument." (memq magit-credential-cache-daemon-process (list-system-processes))) (setq magit-credential-cache-daemon-process - (or (--first (let* ((attr (process-attributes it)) - (comm (cdr (assq 'comm attr))) - (user (cdr (assq 'user attr)))) - (and (string= comm "git-credential-cache--daemon") - (string= user user-login-name))) - (list-system-processes)) + (or (seq-find (lambda (process) + (let* ((attr (process-attributes process)) + (comm (cdr (assq 'comm attr))) + (user (cdr (assq 'user attr)))) + (and (string= comm "git-credential-cache--daemon") + (string= user user-login-name)))) + (list-system-processes)) (condition-case nil (start-process "git-credential-cache--daemon" " *git-credential-cache--daemon*" @@ -1186,8 +1216,6 @@ Limited by `magit-process-error-tooltip-max-lines'." (defvar-local magit-this-error nil) -(defvar magit-process-finish-apply-ansi-colors nil) - (defun magit-process-finish (arg &optional process-buf command-buf default-dir section) (unless (integerp arg) @@ -1247,7 +1275,7 @@ Limited by `magit-process-error-tooltip-max-lines'." 'magit-process-ok 'magit-process-ng))) (set-marker-insertion-type marker t)) - (when magit-process-finish-apply-ansi-colors + (when (eq magit-process-apply-ansi-colors t) (ansi-color-apply-on-region (oref section content) (oref section end))) (if (= (oref section end) @@ -1257,8 +1285,8 @@ Limited by `magit-process-error-tooltip-max-lines'." (delete-char -1) (oset section content nil)) (when (and (= exit-code 0) - (not (--any-p (eq (window-buffer it) buffer) - (window-list)))) + (not (seq-some (##eq (window-buffer %) buffer) + (window-list)))) (magit-section-hide section))))) (defun magit-process-display-buffer (process) diff --git a/elpa/magit-20250107.2324/magit-pull.el b/elpa/magit-20250519.1537/magit-pull.el similarity index 100% rename from elpa/magit-20250107.2324/magit-pull.el rename to elpa/magit-20250519.1537/magit-pull.el diff --git a/elpa/magit-20250107.2324/magit-push.el b/elpa/magit-20250519.1537/magit-push.el similarity index 97% rename from elpa/magit-20250107.2324/magit-push.el rename to elpa/magit-20250519.1537/magit-push.el index c2ba4871..1b8acb42 100644 --- a/elpa/magit-20250107.2324/magit-push.el +++ b/elpa/magit-20250519.1537/magit-push.el @@ -39,13 +39,13 @@ ("-F" "Force" ("-f" "--force")) ("-h" "Disable hooks" "--no-verify") ("-n" "Dry run" ("-n" "--dry-run")) - (5 "-u" "Set upstream" "--set-upstream") - (7 "-t" "Follow tags" "--follow-tags")] + ("-u" "Set upstream" "--set-upstream" :level 5) + ("-T" "Include all tags" "--tags") + ("-t" "Include related annotated tags" "--follow-tags")] [:if magit-get-current-branch - :description (lambda () - (format (propertize "Push %s to" 'face 'transient-heading) + :description (##format (propertize "Push %s to" 'face 'transient-heading) (propertize (magit-get-current-branch) - 'face 'magit-branch-local))) + 'face 'magit-branch-local)) ("p" magit-push-current-to-pushremote) ("u" magit-push-current-to-upstream) ("e" "elsewhere" magit-push-current)] @@ -128,8 +128,8 @@ the upstream." (not (or (magit-get-upstream-branch branch) (magit--unnamed-upstream-p remote merge) (magit--valid-upstream-p remote merge)))) - (let* ((branches (cl-union (--map (concat it "/" branch) - (magit-list-remotes)) + (let* ((branches (cl-union (mapcar (##concat % "/" branch) + (magit-list-remotes)) (magit-list-remote-branch-names) :test #'equal)) (upstream (magit-completing-read diff --git a/elpa/magit-20250107.2324/magit-reflog.el b/elpa/magit-20250519.1537/magit-reflog.el similarity index 100% rename from elpa/magit-20250107.2324/magit-reflog.el rename to elpa/magit-20250519.1537/magit-reflog.el diff --git a/elpa/magit-20250107.2324/magit-refs.el b/elpa/magit-20250519.1537/magit-refs.el similarity index 96% rename from elpa/magit-20250107.2324/magit-refs.el rename to elpa/magit-20250519.1537/magit-refs.el index bfb9f7a8..2bcee3e7 100644 --- a/elpa/magit-20250107.2324/magit-refs.el +++ b/elpa/magit-20250519.1537/magit-refs.el @@ -63,7 +63,7 @@ To change the value in an existing buffer use the command `magit-refs-set-show-commit-count'." :package-version '(magit . "2.1.0") :group 'magit-refs - :safe (lambda (val) (memq val '(all branch nil))) + :safe (##memq % '(all branch nil)) :type '(choice (const :tag "For branches and tags" all) (const :tag "For branches only" branch) (const :tag "Never" nil))) @@ -105,7 +105,7 @@ in the heading preceding the list of its branches." To distinguish branch descriptions from the commit summary of the tip, which is shown when there is no description or this option is disabled, descriptions use the bold face." - :package-version '(magit . "4.2.1") + :package-version '(magit . "4.3.0") :group 'magit-refs :type 'boolean) @@ -134,7 +134,7 @@ AUTHOR-WIDTH has to be an integer. When the name of the author :package-version '(magit . "2.9.0") :group 'magit-refs :group 'magit-margin - :safe (lambda (val) (memq val '(all branch nil))) + :safe (##memq % '(all branch nil)) :type magit-log-margin--custom-type :initialize #'magit-custom-initialize-reset :set-after '(magit-log-margin) @@ -150,7 +150,7 @@ tags." :group 'magit-margin :type 'boolean) -(defcustom magit-refs-primary-column-width (cons 16 32) +(defcustom magit-refs-primary-column-width '(16 . 32) "Width of the focus column in `magit-refs-mode' buffers. The primary column is the column that contains the name of the @@ -247,7 +247,7 @@ the outcome. and lists of cherry commits relative to the reference at point instead of relative to the current buffer or `HEAD'. - Instead of adding this symbol, consider pressing \"C-u y o RET\". + Instead of adding this symbol, consider pressing \\`C-u y o RET'. `create-branch' @@ -333,8 +333,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. (transient-define-prefix magit-show-refs (&optional transient) "List and compare references in a dedicated buffer." :man-page "git-branch" - :value (lambda () - (magit-show-refs-arguments magit-prefix-use-buffer-arguments)) + :value (##magit-show-refs-arguments magit-prefix-use-buffer-arguments) ["Arguments" (magit-for-each-ref:--contains) ("-M" "Merged" "--merged=" magit-transient-read-revision) @@ -566,7 +565,7 @@ line is inserted at all." (magit-refs--format-margin tag)) (magit-refs--insert-cherry-commits tag))))) (insert ?\n) - (magit-make-margin-overlay nil t))))) + (magit-make-margin-overlay))))) (defun magit-insert-remote-branches () "Insert sections showing all remote-tracking branches." @@ -621,7 +620,7 @@ line is inserted at all." (magit-refs--format-margin branch)) (magit-refs--insert-cherry-commits branch)))))))) (insert ?\n) - (magit-make-margin-overlay nil t)))) + (magit-make-margin-overlay)))) (defun magit-insert-local-branches () "Insert sections showing all local branches." @@ -638,7 +637,22 @@ line is inserted at all." (magit-refs--format-margin branch)) (magit-refs--insert-cherry-commits branch)))) (insert ?\n) - (magit-make-margin-overlay nil t))) + (magit-make-margin-overlay))) + +(defun magit-insert-shelved-branches () + "Insert sections showing all shelved branches." + (when-let ((refs (magit-list-refs "refs/shelved/"))) + (magit-insert-section (shelved nil) + (magit-insert-heading t "Shelved branches") + (dolist (ref (nreverse refs)) + (magit-insert-section (shelved-branch ref t) + (magit-insert-heading + " " (magit--propertize-face (substring ref 13) 'magit-refname)) + (when (magit-buffer-margin-p) + (magit-refs--format-margin ref)) + (magit-refs--insert-cherry-commits ref))) + (insert ?\n) + (magit-make-margin-overlay)))) (defun magit-refs--format-local-branches () (let ((lines (seq-keep #'magit-refs--format-local-branch @@ -788,15 +802,12 @@ line is inserted at all." "cherry" "-v" (magit-abbrev-arg) magit-buffer-upstream ref) (if (= (point) start) (message "No cherries for %s" ref) - (magit-make-margin-overlay nil t))))) + (magit-make-margin-overlay))))) (defun magit-refs--format-margin (commit) - (save-excursion - (goto-char (line-beginning-position 0)) - (let ((line (magit-rev-format "%ct%cN" commit))) - (magit-log-format-margin commit - (substring line 10) - (substring line 0 10))))) + (if-let ((line (magit-rev-format "%cN%x00%ct" commit))) + (apply #'magit-log-format-margin commit (split-string line "\0")) + (magit-make-margin-overlay))) ;;; _ (provide 'magit-refs) diff --git a/elpa/magit-20250107.2324/magit-remote.el b/elpa/magit-20250519.1537/magit-remote.el similarity index 93% rename from elpa/magit-20250107.2324/magit-remote.el rename to elpa/magit-20250519.1537/magit-remote.el index 8102c4d3..e4cdab79 100644 --- a/elpa/magit-20250107.2324/magit-remote.el +++ b/elpa/magit-20250519.1537/magit-remote.el @@ -40,10 +40,10 @@ the name of the added remote is equal to that string and the variable isn't already set." :package-version '(magit . "2.4.0") :group 'magit-commands - :type '(choice (const :tag "ask if unset" ask-if-unset) - (const :tag "always ask" ask) - (string :tag "set if named") - (const :tag "don't set"))) + :type '(choice (const :tag "Ask if unset" ask-if-unset) + (const :tag "Always ask" ask) + (string :tag "Set if named") + (const :tag "Don't set"))) (defcustom magit-remote-direct-configure t "Whether the command `magit-remote' shows Git variables. @@ -68,7 +68,7 @@ has to be used to view and change remote related variables." :man-page "git-remote" :value '("-f") ["Variables" - :if (lambda () (and magit-remote-direct-configure (transient-scope))) + :if (##and magit-remote-direct-configure (transient-scope)) ("u" magit-remote..url) ("U" magit-remote..fetch) ("s" magit-remote..pushurl) @@ -83,8 +83,8 @@ has to be used to view and change remote related variables." [("C" "Configure..." magit-remote-configure) ("p" "Prune stale branches" magit-remote-prune) ("P" "Prune stale refspecs" magit-remote-prune-refspecs) - ("b" magit-update-default-branch) - (7 "z" "Unshallow remote" magit-remote-unshallow)]] + (7 "z" "Unshallow remote" magit-remote-unshallow)] + [("d u" magit-update-default-branch)]] (interactive (list (magit-get-current-remote))) (transient-setup 'magit-remote nil nil :scope remote)) @@ -179,12 +179,13 @@ the now stale refspecs. Other stale branches are not removed." (ours (match-string 3 refspec))) (unless (if (string-match "\\*" theirs) (let ((re (replace-match ".*" t t theirs))) - (--some (string-match-p re it) remote-refs)) + (seq-some (##string-match-p re %) remote-refs)) (member theirs remote-refs)) (push (cons refspec (if (string-match "\\*" ours) (let ((re (replace-match ".*" t t ours))) - (--filter (string-match-p re it) tracking-refs)) + (seq-filter (##string-match-p re %) + tracking-refs)) (list (car (member ours tracking-refs))))) stale))))) (if (not stale) @@ -199,7 +200,7 @@ the now stale refspecs. Other stale branches are not removed." variable)) (?r "[r]emove remote" (magit-call-git "remote" "rm" remote)) - (?a "or [a]abort" + (?a "[a]abort" (user-error "Abort"))) (if (if (length= stale 1) (pcase-let ((`(,refspec . ,refs) (car stale))) @@ -209,13 +210,11 @@ the now stale refspecs. Other stale branches are not removed." nil refs)) (magit-confirm 'prune-stale-refspecs nil (format "Prune %%d stale refspecs and %d branches" - (length (mapcan (lambda (s) (copy-sequence (cdr s))) - stale))) + (length (mapcan (##copy-sequence (cdr %)) stale))) nil (mapcar (pcase-lambda (`(,refspec . ,refs)) (concat refspec "\n" - (mapconcat (lambda (b) (concat " " b)) - refs "\n"))) + (mapconcat (##concat " " %) refs "\n"))) stale))) (pcase-dolist (`(,refspec . ,refs) stale) (magit-call-git "config" "--unset" variable @@ -280,8 +279,8 @@ Delete the symbolic-ref \"refs/remotes//HEAD\"." newname) newname "master"))) (cond - ((y-or-n-p (format "Default branch changed from `%s' to `%s' on %s.%s" - oldname newname remote " Do the same locally? ")) + ((y-or-n-p (format "Default branch changed from `%s' to `%s' on %s.%s?" + oldname newname remote " Do the same locally")) (magit--set-default-branch newname oldname) (magit-refresh)) ((user-error "Abort"))))))) @@ -310,10 +309,9 @@ refspec." (transient-define-prefix magit-remote-configure (remote) "Configure a remote." :man-page "git-remote" - [:description - (lambda () - (concat (propertize "Configure " 'face 'transient-heading) - (propertize (transient-scope) 'face 'magit-branch-remote))) + [:description (##concat + (propertize "Configure " 'face 'transient-heading) + (propertize (transient-scope) 'face 'magit-branch-remote)) ("u" magit-remote..url) ("U" magit-remote..fetch) ("s" magit-remote..pushurl) diff --git a/elpa/magit-20250107.2324/magit-repos.el b/elpa/magit-20250519.1537/magit-repos.el similarity index 90% rename from elpa/magit-20250107.2324/magit-repos.el rename to elpa/magit-20250519.1537/magit-repos.el index bb9e933c..b815757c 100644 --- a/elpa/magit-20250107.2324/magit-repos.el +++ b/elpa/magit-20250519.1537/magit-repos.el @@ -56,28 +56,28 @@ This option controls which repositories are being listed by :link '(info-link "(magit)Repository List") :group 'magit-modes) -(defcustom magit-repolist-mode-hook '(hl-line-mode) +(defcustom magit-repolist-mode-hook (list #'hl-line-mode) "Hook run after entering Magit-Repolist mode." :package-version '(magit . "2.9.0") :group 'magit-repolist :type 'hook :get #'magit-hook-custom-get - :options '(hl-line-mode)) + :options (list #'hl-line-mode)) (defcustom magit-repolist-columns - '(("Name" 25 magit-repolist-column-ident + `(("Name" 25 ,#'magit-repolist-column-ident ()) - ("Version" 25 magit-repolist-column-version + ("Version" 25 ,#'magit-repolist-column-version ((:sort magit-repolist-version<))) - ("BU" 3 magit-repolist-column-unpushed-to-upstream + ("B>U" 3 ,#'magit-repolist-column-unpushed-to-upstream (;; (:help-echo "Local changes not in upstream") (:right-align t) (:sort <))) - ("Path" 99 magit-repolist-column-path + ("Path" 99 ,#'magit-repolist-column-path ())) "List of columns displayed by `magit-list-repositories'. @@ -118,9 +118,9 @@ than 9." (sexp :tag "Value")))))) (defcustom magit-repolist-column-flag-alist - '((magit-untracked-files . "N") - (magit-unstaged-files . "U") - (magit-staged-files . "S")) + `((,#'magit-untracked-files . "N") + (,#'magit-unstaged-files . "U") + (,#'magit-staged-files . "S")) "Association list of predicates and flags for `magit-repolist-column-flag'. Each element is of the form (FUNCTION . FLAG). Each FUNCTION is @@ -180,14 +180,14 @@ repositories are displayed." "Fetch all marked or listed repositories." (interactive (list (magit-repolist--get-repos ?*))) (run-hooks 'magit-credential-hook) - (magit-repolist--mapc (apply-partially #'magit-run-git "remote" "update") + (magit-repolist--mapc (##magit-run-git "remote" "update") repos "Fetching in %s...")) (defun magit-repolist-find-file-other-frame (repos file) "Find a file in all marked or listed repositories." (interactive (list (magit-repolist--get-repos ?*) (read-string "Find file in repositories: "))) - (magit-repolist--mapc (apply-partially #'find-file-other-frame file) repos)) + (magit-repolist--mapc (##find-file-other-frame file) repos)) (defun magit-repolist--ensure-padding () "Set `tabulated-list-padding' to 2, unless that is already non-zero." @@ -242,17 +242,16 @@ If it contains \"%s\" then the directory is substituted for that." (let ((base default-directory) (len (length repos)) (i 0)) - (mapc (lambda (repo) - (let ((default-directory - (file-name-as-directory (expand-file-name repo base)))) - (if msg - (let ((msg (concat (format "(%s/%s) " (cl-incf i) len) - (format msg default-directory)))) - (message msg) - (funcall fn) - (message (concat msg "done"))) - (funcall fn)))) - repos))) + (dolist (repo repos) + (let ((default-directory + (file-name-as-directory (expand-file-name repo base)))) + (if msg + (let ((msg (concat (format "(%s/%s) " (cl-incf i) len) + (format msg default-directory)))) + (message msg) + (funcall fn) + (message (concat msg "done"))) + (funcall fn)))))) ;;;; Mode @@ -327,9 +326,9 @@ If it contains \"%s\" then the directory is substituted for that." "")) magit-repolist-columns))))) (magit-list-repos-uniquify - (--map (cons (file-name-nondirectory (directory-file-name it)) - it) - (magit-list-repos))))) + (mapcar (##cons (file-name-nondirectory (directory-file-name %)) + %) + (magit-list-repos))))) (message "Listing repositories...") (tabulated-list-init-header) (tabulated-list-print t) @@ -510,10 +509,10 @@ instead." (cond ((file-readable-p (expand-file-name ".git" directory)) (list (file-name-as-directory directory))) ((and (> depth 0) (file-accessible-directory-p directory)) - (--mapcat (and (file-directory-p it) - (magit-list-repos-1 it (1- depth))) - (directory-files directory t - directory-files-no-dot-files-regexp t))))) + (mapcan (##and (file-directory-p %) + (magit-list-repos-1 % (1- depth))) + (directory-files directory t + directory-files-no-dot-files-regexp t))))) (defun magit-list-repos-uniquify (alist) (let (result (dict (make-hash-table :test #'equal))) @@ -524,22 +523,24 @@ instead." (if (length= value 1) (push (cons key (car value)) result) (setq result - (append result - (magit-list-repos-uniquify - (--map (cons (concat - key "\\" - (file-name-nondirectory - (directory-file-name - (substring it 0 (- (1+ (length key))))))) - it) - value)))))) + (append + result + (magit-list-repos-uniquify + (mapcar (lambda (v) + (cons (concat + key "\\" + (file-name-nondirectory + (directory-file-name + (substring v 0 (- (1+ (length key))))))) + v)) + value)))))) dict) result)) (defun magit-repos-alist () (magit-list-repos-uniquify - (--map (cons (file-name-nondirectory (directory-file-name it)) it) - (magit-list-repos)))) + (mapcar (##cons (file-name-nondirectory (directory-file-name %)) %) + (magit-list-repos)))) ;;; _ (provide 'magit-repos) diff --git a/elpa/magit-20250107.2324/magit-reset.el b/elpa/magit-20250519.1537/magit-reset.el similarity index 100% rename from elpa/magit-20250107.2324/magit-reset.el rename to elpa/magit-20250519.1537/magit-reset.el diff --git a/elpa/magit-20250107.2324/magit-sequence.el b/elpa/magit-20250519.1537/magit-sequence.el similarity index 90% rename from elpa/magit-20250107.2324/magit-sequence.el rename to elpa/magit-20250519.1537/magit-sequence.el index 048a53d5..90e352a7 100644 --- a/elpa/magit-20250107.2324/magit-sequence.el +++ b/elpa/magit-20250519.1537/magit-sequence.el @@ -144,8 +144,8 @@ This discards all changes made since the sequence started." ("-F" "Attempt fast-forward" "--ff") ("-x" "Reference cherry in commit message" "-x") ("-e" "Edit commit messages" ("-e" "--edit")) - ("-s" "Add Signed-off-by lines" ("-s" "--signoff")) - (5 magit:--gpg-sign)] + (magit:--gpg-sign) + (magit:--signoff)] [:if-not magit-sequencer-in-progress-p ["Apply here" ("A" "Pick" magit-cherry-copy) @@ -343,11 +343,11 @@ the process manually." (let ((merges (seq-filter #'magit-merge-commit-p commits))) (cond ((not merges) - (--remove (string-prefix-p "--mainline=" it) args)) + (seq-remove (##string-prefix-p "--mainline=" %) args)) ((cl-set-difference commits merges :test #'equal) (user-error "Cannot %s merge and non-merge commits at once" command)) - ((--first (string-prefix-p "--mainline=" it) args) + ((seq-find (##string-prefix-p "--mainline=" %) args) args) (t (cons (format "--mainline=%s" @@ -378,8 +378,8 @@ the process manually." ("-e" "Edit commit message" ("-e" "--edit")) ("-E" "Don't edit commit message" "--no-edit") ("=s" magit-merge:--strategy) - ("-s" "Add Signed-off-by lines" ("-s" "--signoff")) - (5 magit:--gpg-sign)] + (magit:--gpg-sign) + (magit:--signoff)] ["Actions" :if-not magit-sequencer-in-progress-p ("V" "Revert commit(s)" magit-revert-and-commit) @@ -439,8 +439,8 @@ without prompting." ("-b" "Limit removal of email cruft" "--keep-non-patch") ("-d" "Use author date as committer date" "--committer-date-is-author-date") ("-t" "Use current time as author date" "--ignore-date") - ("-s" "Add Signed-off-by lines" ("-s" "--signoff")) - (5 magit:--gpg-sign)] + (magit:--gpg-sign) + (magit:--signoff)] ["Apply" :if-not magit-am-in-progress-p ("m" "maildir" magit-am-apply-maildir) @@ -474,9 +474,9 @@ without prompting." nil default)))) (magit-am-arguments))) (magit-run-git-sequencer "am" args "--" - (--map (magit-convert-filename-for-git - (expand-file-name it)) - files))) + (mapcar (##magit-convert-filename-for-git + (expand-file-name %)) + files))) ;;;###autoload (defun magit-am-apply-maildir (&optional maildir args) @@ -528,11 +528,11 @@ This discards all changes made since the sequence started." :if-not magit-rebase-in-progress-p ("-k" "Keep empty commits" "--keep-empty") ("-p" "Preserve merges" ("-p" "--preserve-merges") - :if (lambda () (magit-git-version< "2.33.0"))) + :if (##magit-git-version< "2.33.0")) ("-r" "Rebase merges" ("-r" "--rebase-merges=") magit-rebase-merges-select-mode) ("-u" "Update branches" "--update-refs" - :if (lambda () (magit-git-version>= "2.38.0"))) + :if (##magit-git-version>= "2.38.0")) (7 magit-merge:--strategy) (7 magit-merge:--strategy-option) (7 "=X" magit-diff:--diff-algorithm :argument "-Xdiff-algorithm=") @@ -544,12 +544,12 @@ This discards all changes made since the sequence started." ("-i" "Interactive" ("-i" "--interactive")) ("-h" "Disable hooks" "--no-verify") (7 magit-rebase:--exec) - (5 magit:--gpg-sign)] + (magit:--gpg-sign) + (magit:--signoff)] [:if-not magit-rebase-in-progress-p - :description (lambda () - (format (propertize "Rebase %s onto" 'face 'transient-heading) + :description (##format (propertize "Rebase %s onto" 'face 'transient-heading) (propertize (or (magit-get-current-branch) "HEAD") - 'face 'magit-branch-local))) + 'face 'magit-branch-local)) ("p" magit-rebase-onto-pushremote) ("u" magit-rebase-onto-upstream) ("e" "elsewhere" magit-rebase-branch)] @@ -559,8 +559,8 @@ This discards all changes made since the sequence started." ("s" "a subset" magit-rebase-subset)] [("m" "to modify a commit" magit-rebase-edit-commit) ("w" "to reword a commit" magit-rebase-reword-commit) - ("k" "to remove a commit" magit-rebase-remove-commit) - ("f" "to autosquash" magit-rebase-autosquash) + ("k" "to remove a commit" magit-rebase-remove-commit)] + [("f" "to autosquash" magit-rebase-autosquash) (6 "t" "to change dates" magit-reshelve-since)]] ["Actions" :if magit-rebase-in-progress-p @@ -674,21 +674,17 @@ START has to be selected from a list of recent commits." (commit args message &optional editor delay-edit-confirm noassert confirm) (declare (indent 2)) (when commit - (if (eq commit :merge-base) - (setq commit - (and-let* ((upstream (magit-get-upstream-branch))) - (magit-git-string "merge-base" upstream "HEAD"))) - (unless (magit-rev-ancestor-p commit "HEAD") - (user-error "%s isn't an ancestor of HEAD" commit)) - (if (magit-commit-parents commit) - (when (or (not (eq this-command 'magit-rebase-interactive)) - magit-rebase-interactive-include-selected) - (setq commit (concat commit "^"))) - (setq args (cons "--root" args))))) + (unless (magit-rev-ancestor-p commit "HEAD") + (user-error "%s isn't an ancestor of HEAD" commit)) + (if (magit-commit-parents commit) + (when (or (not (eq this-command 'magit-rebase-interactive)) + magit-rebase-interactive-include-selected) + (setq commit (concat commit "^"))) + (setq args (cons "--root" args)))) (when (and commit (not noassert)) (setq commit (magit-rebase-interactive-assert commit delay-edit-confirm - (--some (string-prefix-p "--rebase-merges" it) args)))) + (seq-some (##string-prefix-p "--rebase-merges" %) args)))) (if (and commit (not confirm)) (let ((process-environment process-environment)) (when editor @@ -725,7 +721,7 @@ START has to be selected from a list of recent commits." ;; merely to add new commits *after* it. Try not to ;; ask users whether they really want to edit public ;; commits, when they don't actually intend to do so. - (not (--all-p (magit-rev-equal it commit) branches)))) + (not (seq-every-p (##magit-rev-equal % commit) branches)))) (let ((m1 "Some of these commits have already been published to ") (m2 ".\nDo you really want to modify them")) (magit-confirm (or magit--rebase-published-symbol 'rebase-published) @@ -760,10 +756,17 @@ START has to be selected from a list of recent commits." nil t)) ;;;###autoload -(defun magit-rebase-autosquash (args) - "Combine squash and fixup commits with their intended targets." - (interactive (list (magit-rebase-arguments))) - (magit-rebase-interactive-1 :merge-base +(defun magit-rebase-autosquash (select args) + "Combine squash and fixup commits with their intended targets. +By default only squash into commits that are not reachable from +the upstream branch. If no upstream is configured or with a prefix +argument, prompt for the first commit to potentially squash into." + (interactive (list current-prefix-arg + (magit-rebase-arguments))) + (magit-rebase-interactive-1 + (and-let* (((not select)) + (upstream (magit-get-upstream-branch))) + (magit-git-string "merge-base" upstream "HEAD")) (nconc (list "--autosquash" "--keep-empty") args) "Type %p on a commit to squash into it and then rebase as necessary," "true" nil t)) @@ -810,7 +813,7 @@ START has to be selected from a list of recent commits." (edit "edit") (remove "noop\n# pick") (reword "reword") - (t (error "unknown action: %s" action))) + (t (error "Unknown action: %s" action))) commit))) ;;;###autoload @@ -965,9 +968,8 @@ If no such sequence is in progress, do nothing." If no such sequence is in progress, do nothing." (when (magit-rebase-in-progress-p) (let* ((gitdir (magit-gitdir)) - (interactive - (file-directory-p (expand-file-name "rebase-merge" gitdir))) - (dir (if interactive "rebase-merge/" "rebase-apply/")) + (mergep (file-directory-p (expand-file-name "rebase-merge" gitdir))) + (dir (if mergep "rebase-merge/" "rebase-apply/")) (name (thread-first (concat dir "head-name") (expand-file-name gitdir) magit-file-line)) @@ -979,7 +981,7 @@ If no such sequence is in progress, do nothing." (name (or (magit-rev-name name "refs/heads/*") name))) (magit-insert-section (rebase-sequence) (magit-insert-heading (format "Rebasing %s onto %s" name onto)) - (if interactive + (if mergep (magit-rebase-insert-merge-sequence onto) (magit-rebase-insert-apply-sequence onto)) (insert ?\n))))) @@ -989,36 +991,42 @@ If no such sequence is in progress, do nothing." These are ordered in that the same way they'll be sorted in the status buffer (i.e., the reverse of how they will be applied)." (let ((comment-start (or (magit-get "core.commentChar") "#")) - lines) + (commits ()) + (actions ())) (with-temp-buffer (insert-file-contents (expand-file-name "rebase-merge/git-rebase-todo" (magit-gitdir))) (while (not (eobp)) - (let ((ln (git-rebase-current-line))) - (when (oref ln action-type) - (push ln lines))) + (when-let ((obj (git-rebase-current-line))) + (push obj actions) + (when (memq (oref obj action-type) '(commit merge)) + (push obj commits))) (forward-line))) - lines)) + (let ((abbrevs + (and commits + (magit-git-lines + "log" "--no-walk=unsorted" "--format=%h" + (mapcar (lambda (obj) + (if (eq (oref obj action-type) 'merge) + (let ((options (oref obj action-options))) + (and (string-match "-[cC] \\([^ ]+\\)" options) + (match-string 1 options))) + (oref obj target))) + commits))))) + (cl-assert (equal (length commits) (length abbrevs))) + (while-let ((obj (pop commits)) + (val (pop abbrevs))) + (oset obj abbrev val))) + actions)) (defun magit-rebase-insert-merge-sequence (onto) - (dolist (line (magit-rebase--todo)) - (with-slots (action-type action action-options target) line + (dolist (obj (magit-rebase--todo)) + (with-slots (action-type action action-options target abbrev trailer) obj (pcase action-type - ('commit - (magit-sequence-insert-commit action target 'magit-sequence-pick)) - ((or (or `exec `label) - (and `merge (guard (not action-options)))) - (insert (propertize action 'font-lock-face 'magit-sequence-onto) "\s" - (propertize target 'font-lock-face 'git-rebase-label) "\n")) - ('merge - (if-let ((hash (and (string-match "-[cC] \\([^ ]+\\)" action-options) - (match-string 1 action-options)))) - (magit-insert-section (commit hash) - (magit-insert-heading - (propertize "merge" 'font-lock-face 'magit-sequence-pick) - "\s" - (magit-format-rev-summary hash) "\n")) - (error "failed to parse merge message hash")))))) + ((or 'commit (and 'merge (guard abbrev))) + (magit-sequence-insert-commit action target 'magit-sequence-pick + abbrev trailer)) + ((guard action) (magit-sequence-insert-step action target))))) (let ((dir (magit-gitdir))) (magit-sequence-insert-sequence (magit-file-line (expand-file-name "rebase-merge/stopped-sha" dir)) @@ -1030,9 +1038,9 @@ status buffer (i.e., the reverse of how they will be applied)." (defun magit-rebase-insert-apply-sequence (onto) (let* ((dir (magit-gitdir)) (rewritten - (--map (car (split-string it)) - (magit-file-lines - (expand-file-name "rebase-apply/rewritten" dir)))) + (mapcar (##car (split-string %)) + (magit-file-lines + (expand-file-name "rebase-apply/rewritten" dir)))) (stop (magit-file-line (expand-file-name "rebase-apply/original-commit" dir)))) (dolist (patch (nreverse (cdr (magit-rebase-patches)))) @@ -1051,13 +1059,15 @@ status buffer (i.e., the reverse of how they will be applied)." (defun magit-sequence-insert-sequence (stop onto &optional orig) (let ((head (magit-rev-parse "HEAD")) done) (setq onto (if onto (magit-rev-parse onto) head)) - (setq done (magit-git-lines "log" "--format=%H" (concat onto "..HEAD"))) - (when (and stop (not (member (magit-rev-parse stop) done))) + (setq done (mapcar (##split-string % "\0") + (magit-git-lines "log" "--format=%H%x00%h%x00%s" + (concat onto "..HEAD")))) + (when (and stop (not (assoc (magit-rev-parse stop) done))) (let ((id (magit-patch-id stop))) - (if-let ((matched (--first (equal (magit-patch-id it) id) done))) + (if-let ((matched (car (assoc (##equal (magit-patch-id %) id) done)))) (setq stop matched) (cond - ((--first (magit-rev-equal it stop) done) + ((assoc (##magit-rev-equal % stop) done) ;; The commit's testament has been executed. (magit-sequence-insert-commit "void" stop 'magit-sequence-drop)) ;; The faith of the commit is still undecided... @@ -1083,14 +1093,14 @@ status buffer (i.e., the reverse of how they will be applied)." (t "work"))) stop 'magit-sequence-part)) ;; The commit is definitely gone... - ((--first (magit-rev-equal it stop) done) + ((assoc (##magit-rev-equal % stop) done) ;; ...but all of its changes are still in effect. (magit-sequence-insert-commit "poof" stop 'magit-sequence-drop)) (t ;; ...and some changes are gone and/or other changes were added. (magit-sequence-insert-commit "gone" stop 'magit-sequence-drop))) (setq stop nil)))) - (dolist (rev done) + (pcase-dolist (`(,rev ,abbrev ,msg) done) (apply #'magit-sequence-insert-commit (cond ((equal rev stop) ;; ...but its reincarnation lives on. @@ -1102,21 +1112,32 @@ status buffer (i.e., the reverse of how they will be applied)." "like") ; There are new commits. rev (if (equal rev head) 'magit-sequence-head - 'magit-sequence-stop))) + 'magit-sequence-stop) + abbrev msg)) ((equal rev head) - (list "done" rev 'magit-sequence-head)) + (list "done" rev 'magit-sequence-head abbrev msg)) (t - (list "done" rev 'magit-sequence-done))))) + (list "done" rev 'magit-sequence-done abbrev msg))))) (magit-sequence-insert-commit "onto" onto (if (equal onto head) 'magit-sequence-head 'magit-sequence-onto)))) -(defun magit-sequence-insert-commit (type hash face) +(defun magit-sequence-insert-commit (type hash face &optional abbrev msg) (magit-insert-section (commit hash) (magit-insert-heading - (propertize type 'font-lock-face face) "\s" - (magit-format-rev-summary hash) "\n"))) + (propertize type 'font-lock-face face) " " + (if abbrev + (concat (propertize abbrev 'face 'magit-hash) " " msg "\n") + (concat (magit-format-rev-summary hash) "\n"))))) + +(defun magit-sequence-insert-step (type target) + (magit-insert-section (rebase-step (cons type target)) + (magit-insert-heading + (propertize type 'font-lock-face 'magit-sequence-pick) + (and target + (concat "\s" + (propertize target 'font-lock-face 'git-rebase-label)))))) ;;; _ (provide 'magit-sequence) diff --git a/elpa/magit-20250107.2324/magit-sparse-checkout.el b/elpa/magit-20250519.1537/magit-sparse-checkout.el similarity index 99% rename from elpa/magit-20250107.2324/magit-sparse-checkout.el rename to elpa/magit-20250519.1537/magit-sparse-checkout.el index d5ab0e9e..1df657a7 100644 --- a/elpa/magit-20250107.2324/magit-sparse-checkout.el +++ b/elpa/magit-20250519.1537/magit-sparse-checkout.el @@ -113,7 +113,7 @@ directories, call `magit-sparse-checkout-set' instead." (let ((re (concat "\\`" (regexp-opt (magit-sparse-checkout-directories))))) - (lambda (d) (string-match-p re d))) + (##string-match-p re %)) (magit-revision-directories "HEAD"))))) (magit-sparse-checkout--auto-enable) (magit-run-git-async "sparse-checkout" "add" directories)) diff --git a/elpa/magit-20250107.2324/magit-stash.el b/elpa/magit-20250519.1537/magit-stash.el similarity index 96% rename from elpa/magit-20250107.2324/magit-stash.el rename to elpa/magit-20250519.1537/magit-stash.el index cf1830ac..4ceea526 100644 --- a/elpa/magit-20250107.2324/magit-stash.el +++ b/elpa/magit-20250519.1537/magit-stash.el @@ -129,8 +129,8 @@ while two prefix arguments are equivalent to `--all'." (interactive (progn (when (and (magit-merge-in-progress-p) (not (magit-y-or-n-p "\ -Stashing and resetting during a merge conflict. \ -Applying the resulting stash won't restore the merge state. \ +Stashing and resetting during a merge conflict. \ +Applying the resulting stash won't restore the merge state. \ Proceed anyway? "))) (user-error "Abort")) (magit-stash-read-args))) @@ -143,7 +143,7 @@ Unstaged and untracked changes are not stashed. The stashed changes are applied in reverse to both the index and the worktree. This command can fail when the worktree is not clean. Applying the resulting stash has the inverse effect." - (interactive (list (magit-stash-read-message))) + (interactive (list (funcall magit-stash-read-message-function))) (magit-stash-save message t nil nil t 'worktree)) ;;;###autoload @@ -173,14 +173,15 @@ while two prefix arguments are equivalent to `--all'." The message that Git would have picked, is available as the default (used when the user enters the empty string) and as -the next history element (which can be accessed with \ -\\\\[next-history-element])." - (read-string (format "Stash message (default: On%s:%s): " - (magit--ellipsis) (magit--ellipsis)) - nil nil - (format "On %s: %s" - (or (magit-get-current-branch) "(no branch)") - (magit-rev-format "%h %s")))) +the first future history element. The second future history +element is just \"On BRANCH: \". Future history elements can +be accessed using \\\\[next-history-element])." + (let ((branch (or (magit-get-current-branch) "(no branch)")) + (ellipsis (magit--ellipsis))) + (read-string (format "Stash message (default: On%s:%s): " ellipsis ellipsis) + nil nil + (list (format "On %s: %s" branch (magit-rev-format "%h %s")) + (format "On %s: " branch))))) (defun magit-stash-read-message-traditional () "Read a message from the minibuffer, to be used for a stash. @@ -330,7 +331,7 @@ want to fall back to using \"--3way\", without being prompted." (concat "Could not apply stash because of unstaged changes.\n\n" "To do a tree-way merge, these files have to be staged\n" - (mapconcat (lambda (f) (format " %s" f)) conflicts "\n") + (mapconcat (##format " %s" %) conflicts "\n") "\n") nil (?s (format @@ -412,7 +413,7 @@ Then apply STASH, dropping it if it applies cleanly." ;;;###autoload (defun magit-stash-format-patch (stash) - "Create a patch from STASH" + "Create a patch from STASH." (interactive (list (magit-read-stash "Create patch from stash"))) (with-temp-file (magit-rev-format "0001-%f.patch" stash) (magit-git-insert "stash" "show" "-p" stash)) @@ -527,16 +528,12 @@ instead of \"Stashes:\"." (magit-insert-section (stash autostash) (insert (propertize "AUTOSTASH" 'font-lock-face 'magit-hash)) (insert " " msg "\n") - (save-excursion - (backward-char) - (magit-log-format-margin autostash author date))))) + (magit-log-format-margin autostash author date)))) (if verified (magit-git-wash (apply-partially #'magit-log-wash-log 'stash) "reflog" "--format=%gd%x00%aN%x00%at%x00%gs" ref) (insert ?\n) - (save-excursion - (backward-char) - (magit-make-margin-overlay))))))) + (magit-make-margin-overlay)))))) ;;; List Stashes @@ -615,6 +612,9 @@ If there is no stash buffer in the same frame, then do nothing." (magit-hack-dir-local-variables) (setq magit--imenu-group-types '(commit))) +(put 'magit-stash-mode 'magit-diff-default-arguments + '("--no-ext-diff")) + (defun magit-stash-setup-buffer (stash args files) (magit-setup-buffer #'magit-stash-mode nil (magit-buffer-revision stash) diff --git a/elpa/magit-20250107.2324/magit-status.el b/elpa/magit-20250519.1537/magit-status.el similarity index 81% rename from elpa/magit-20250107.2324/magit-status.el rename to elpa/magit-20250519.1537/magit-status.el index 193693d4..970d7274 100644 --- a/elpa/magit-20250107.2324/magit-status.el +++ b/elpa/magit-20250519.1537/magit-status.el @@ -109,9 +109,9 @@ See option `magit-section-initial-visibility-alist' for how to control the initial visibility of the jumped to section." :package-version '(magit . "2.90.0") :group 'magit-status - :type '(choice (const :tag "as usual" nil) - (repeat (choice (number :tag "nth top-level section") - (sexp :tag "section identity"))))) + :type '(choice (const :tag "As usual" nil) + (repeat (choice (number :tag "Nth top-level section") + (sexp :tag "Section identity"))))) (defcustom magit-status-goto-file-position nil "Whether to go to position corresponding to file position. @@ -142,57 +142,50 @@ The functions which respect this option are :group 'magit-status :type 'boolean) -(defcustom magit-status-show-untracked-files nil - "Whether and how to list untracked files in the status buffer. +(defcustom magit-status-show-untracked-files t + "Whether to list untracked files in the status buffer. -This controls the behavior of function `magit-insert-untracked-files'. -If that function is removed from `magit-status-sections-hook', then -untracked files are not shown, regardless of what this option says. +- If nil, do not list any untracked files. +- If t, list untracked files, but if a directory does not contain any + untracked files, then only list that directory, not the contained + untracked files. +- If all, then list each individual untracked files. This is can be + very slow and is discouraged. -The behavior can be controled using this option and/or the Git variable -`status.showUntrackedFiles'. The following settings are used in order: +The corresponding values for the Git variable are \"no\", \"normal\" +and \"all\". -1. The buffer-local value of this option. +To disable listing untracked files in a specific repository only, add +the following to \".dir-locals.el\": - This can be set in \".dir-locals-2.el\" like so: - ((magit-status-mode - (magit-status-show-untracked-files . \"no\"))) + ((magit-status-mode + (magit-status-show-untracked-files . \"no\"))) -2. The repository-local value of `status.showUntrackedFiles'. +Alternatively (and mostly for historic reasons), it is possible to use +`git-config' to set the repository-local value: - This can be set using: - git config --local status.showUntrackedFiles normal + git config set --local status.showUntrackedFiles no -3. The global value of this option. +This does *not* override the (if any) local value of this Lisp variable, +but it does override its global value. - This can be set using the Custom interface or `setq'. - -4. The global value of `status.showUntrackedFiles'. - - This can be set using: - git config --global status.showUntrackedFiles all - -5. The default is \"normal\" and is used if all of the above places - are unspecified or, in the case of the Lisp values, nil. - -The valid non-nil values are: - -- \"no\" - Show no untracked files. - -- \"normal\" - Show top-level untracked files and directories containing - untracked files. The directories can be expanded to reveal the - contained untracked files. - -- \"all\" - Immediately show all individual untracked files. This is - potentially expensive and/or overwhelming, and should be avoided." - :package-version '(magit . "4.2.1") +See the last section in the git-status(1) manpage, to speed up the part +of the work Git is responsible for. Turning that list into sections is +also not free, so Magit only lists `magit-status-file-list-limit' files." + :package-version '(magit . "4.3.0") :group 'magit-status - :type '(choice - (const :tag "Show no untracked files" "no") - (const :tag "Show directories containing untracked files" "normal") - (const :tag "Show individual untracked files" "all") - (const :tag "Use value of status.showUntrackedFiles" nil)) - :safe (lambda (value) (member value '("no" "normal" "all" nil)))) + :type '(choice (const :tag "Do not list untracked files" nil) + (const :tag "List mixture of files and directories" t) + (const :tag "List individual files (slow)" all)) + :safe (##memq % '(nil t all))) + +(defcustom magit-status-file-list-limit 100 + "How many files to list in file list sections in the status buffer. +For performance reasons, it is recommended that you do not +increase this limit." + :package-version '(magit . "4.3.0") + :group 'magit-status + :type 'natnum) (defcustom magit-status-margin (list nil @@ -246,10 +239,10 @@ Valid values are: :group 'magit-buffers :group 'magit-commands :type '(choice - (const :tag "always use args from buffer" always) - (const :tag "use args from buffer if displayed in frame" selected) - (const :tag "use args from buffer if it is current" current) - (const :tag "never use args from buffer" never))) + (const :tag "Always use args from buffer" always) + (const :tag "Use args from buffer if displayed in frame" selected) + (const :tag "Use args from buffer if it is current" current) + (const :tag "Never use args from buffer" never))) ;;; Commands @@ -441,7 +434,7 @@ Type \\[magit-commit] to create a commit. :group 'magit-status (magit-hack-dir-local-variables) (when magit-status-initial-section - (add-hook 'magit-post-create-buffer-hook + (add-hook 'magit--initial-section-hook #'magit-status-goto-initial-section nil t)) (setq magit--imenu-group-types '(not branch commit))) @@ -491,12 +484,13 @@ Type \\[magit-commit] to create a commit. (defun magit-status-goto-initial-section () "Jump to the section specified by `magit-status-initial-section'." (when-let ((section - (--some (if (integerp it) - (nth (1- it) - (magit-section-siblings (magit-current-section) - 'next)) - (magit-get-section it)) - magit-status-initial-section))) + (seq-some (lambda (initial) + (if (integerp initial) + (nth (1- initial) + (magit-section-siblings + (magit-current-section) 'next)) + (magit-get-section initial))) + magit-status-initial-section))) (goto-char (oref section start)) (when-let ((vis (cdr (assq 'magit-status-initial-section magit-section-initial-visibility-alist)))) @@ -576,13 +570,12 @@ the status buffer causes this section to disappear again." "Insert a header line about the current branch. If `HEAD' is detached, then insert information about that commit instead. The optional BRANCH argument is for internal use only." - (let ((branch (or branch (magit-get-current-branch))) - (output (magit-rev-format "%h %s" (or branch "HEAD")))) + (let ((output (magit-rev-format "%h %s" (or branch "HEAD")))) (string-match "^\\([^ ]+\\) \\(.*\\)" output) (magit-bind-match-strings (commit summary) output (when (equal summary "") (setq summary "(no commit message)")) - (if branch + (if-let ((branch (or branch (magit-get-current-branch)))) (magit-insert-section (branch branch) (insert (format "%-10s" "Head: ")) (when magit-status-show-hashes-in-headers @@ -734,7 +727,7 @@ remote in alphabetic order." (defvar-keymap magit-untracked-section-map :doc "Keymap for the `untracked' section." " " #'magit-discard - " " #'magit-stage + " " #'magit-stage "<2>" (magit-menu-item "Discard files" #'magit-discard) "<1>" (magit-menu-item "Stage files" #'magit-stage)) @@ -755,100 +748,79 @@ remote in alphabetic order." magit-insert-assume-unchanged-files) (defun magit-insert-untracked-files () - "Maybe insert a list or tree of untracked files. - -The option `magit-status-show-untracked-files' (which see), in -cooperation with the Git variable `status.showUntrackedFiles', control -whether and how that is done. - -If the first element of `magit-buffer-diff-files' is a directory, then -limit the list to files below that. The value of that variable can be -set using \"D -- DIRECTORY RET g\"." - (let ((show (or (and (local-variable-p 'magit-status-show-untracked-files) + "Maybe insert list of untracked files. + +List files if `magit-status-show-untracked-files' is non-nil, but also +take the local value of Git variable `status.showUntrackedFiles' into +account. The local value of the Lisp variable takes precedence over the +local value of the Git variable. The global value of the Git variable +is always ignored." + (when-let* + ((value (or (and (local-variable-p 'magit-status-show-untracked-files) magit-status-show-untracked-files) - (magit-get "--local" "status.showUntrackedFiles") - (default-value 'magit-status-show-untracked-files) - (magit-get "--global" "status.showUntrackedFiles") - "normal"))) - (unless (equal show "no") - (let* ((all (equal show "all")) - (base (car magit-buffer-diff-files)) - (base (and base (file-directory-p base) base))) - (magit-insert-files 'untracked - (lambda () (magit-untracked-files nil base all)) - all))))) + (pcase (magit-get "--local" "status.showUntrackedFiles") + ((or "no" "off" "false" "0") 'no) + ((or "yes" "on" "true" "1") t) + ("all" 'all)) + magit-status-show-untracked-files)) + ((not (eq value 'no)))) + (magit-insert-files + 'untracked + (lambda (files) + (mapcan (##and (eq (aref % 0) ??) + (list (substring % 3))) + (apply #'magit-git-items "status" "-z" "--porcelain" + (format "--untracked-files=%s" + (if (eq value 'all) "all" "normal")) + "--" files)))))) (defun magit-insert-tracked-files () - "Insert a tree of tracked files. - -If the first element of `magit-buffer-diff-files' is a -directory, then limit the list to files below that. The value -value of that variable can be set using \"D -- DIRECTORY RET g\"." + "Insert a list of tracked files. +Honor the buffer's file filter, which can be set using \"D - -\"." (magit-insert-files 'tracked #'magit-list-files)) (defun magit-insert-ignored-files () - "Insert a tree of ignored files. - -If the first element of `magit-buffer-diff-files' is a -directory, then limit the list to files below that. The value -of that variable can be set using \"D -- DIRECTORY RET g\"." - (magit-insert-files 'ignored #'magit-ignored-files)) + "Insert a list of ignored files. +Honor the buffer's file filter, which can be set using \"D - -\"." + (magit-insert-files 'ignored (##magit-ignored-files "--directory" %))) (defun magit-insert-skip-worktree-files () - "Insert a tree of skip-worktree files. - -If the first element of `magit-buffer-diff-files' is a -directory, then limit the list to files below that. The value -of that variable can be set using \"D -- DIRECTORY RET g\"." + "Insert a list of skip-worktree files. +Honor the buffer's file filter, which can be set using \"D - -\"." (magit-insert-files 'skip-worktree #'magit-skip-worktree-files)) (defun magit-insert-assume-unchanged-files () - "Insert a tree of files that are assumed to be unchanged. - -If the first element of `magit-buffer-diff-files' is a -directory, then limit the list to files below that. The value -of that variable can be set using \"D -- DIRECTORY RET g\"." + "Insert a list of files that are assumed to be unchanged. +Honor the buffer's file filter, which can be set using \"D - -\"." (magit-insert-files 'assume-unchanged #'magit-assume-unchanged-files)) -(defvar magit-file-section-indent nil - "Indentation used for simple `file' sections. -If non-nil, this must be a string or character, and is used as -indentation of `file' sections inserted by `magit-insert-*-files'. -`file' sections that are part of diffs are not affected. This is mainly -intended as a workaround for https://github.com/magit/magit/issues/5176, -in which case ?\N{ZERO WIDTH SPACE} is a good value.") - -(defun magit-insert-files (type fn &optional nogroup) - (when-let ((files (funcall fn))) - (let* ((base (car magit-buffer-diff-files)) - (base (and base (file-directory-p base) base)) - (title (symbol-name type))) - (magit-insert-section ((eval type) nil t) - (magit-insert-heading (length files) +(defun magit-insert-files (type fn) + (when-let ((files (funcall fn + (and magit-buffer-diff-files + (cons "--" magit-buffer-diff-files))))) + (magit-insert-section section ((eval type) nil t) + (magit-insert-heading (length files) + (let ((title (symbol-name type))) (format "%c%s files" (capitalize (aref title 0)) - (substring title 1))) - (magit-insert-files-1 files base nogroup) - (insert ?\n))))) - -(defun magit-insert-files-1 (files directory &optional nogroup) - (while (and files (or nogroup - (not directory) - (string-prefix-p directory (car files)))) - (let ((dir (file-name-directory (car files)))) - (if (or nogroup (equal dir directory)) - (let ((file (pop files))) - (magit-insert-section (file file) - (when magit-file-section-indent - (insert magit-file-section-indent)) - (insert (propertize file 'font-lock-face 'magit-filename) ?\n))) - (magit-insert-section (file dir t) - (when magit-file-section-indent - (insert magit-file-section-indent)) - (insert (propertize dir 'file 'magit-filename) ?\n) - (magit-insert-heading) - (setq files (magit-insert-files-1 files dir)))))) - files) + (substring title 1)))) + (magit-insert-section-body + (let ((magit-section-insert-in-reverse t) + (limit magit-status-file-list-limit)) + (while (and files (> limit 0)) + (cl-decf limit) + (let ((file (pop files))) + (magit-insert-section (file file) + (insert (funcall magit-format-file-function + 'list file 'magit-filename)) + (insert ?\n)))) + (when files + (magit-insert-section (info) + (insert (propertize + (format "%s files not listed\n" (length files)) + 'face 'warning))))) + (insert ?\n) + (oset section children (nreverse (oref section children))))))) ;;; _ (provide 'magit-status) diff --git a/elpa/magit-20250107.2324/magit-submodule.el b/elpa/magit-20250519.1537/magit-submodule.el similarity index 93% rename from elpa/magit-20250107.2324/magit-submodule.el rename to elpa/magit-20250519.1537/magit-submodule.el index 66a0937c..9d2b3368 100644 --- a/elpa/magit-20250107.2324/magit-submodule.el +++ b/elpa/magit-20250519.1537/magit-submodule.el @@ -20,12 +20,16 @@ ;; You should have received a copy of the GNU General Public License ;; along with Magit. If not, see . +;;; Commentary: + +;; This library implements support for "git submodule". + +;; See (info "(magit)Submodules"). + ;;; Code: (require 'magit) -(defvar x-stretch-cursor) - ;;; Options (defcustom magit-module-sections-hook @@ -53,37 +57,37 @@ is inserted. If it is nil, then all sections listed in :group 'magit-status :type 'boolean) -(defcustom magit-submodule-list-mode-hook '(hl-line-mode) +(defcustom magit-submodule-list-mode-hook (list #'hl-line-mode) "Hook run after entering Magit-Submodule-List mode." :package-version '(magit . "2.9.0") :group 'magit-repolist :type 'hook :get 'magit-hook-custom-get - :options '(hl-line-mode)) + :options (list #'hl-line-mode)) (defcustom magit-submodule-list-columns - '(("Path" 25 magit-modulelist-column-path + `(("Path" 25 ,#'magit-modulelist-column-path ()) - ("Version" 25 magit-repolist-column-version + ("Version" 25 ,#'magit-repolist-column-version ((:sort magit-repolist-version<))) - ("Branch" 20 magit-repolist-column-branch + ("Branch" 20 ,#'magit-repolist-column-branch ()) - ("BP" 3 magit-repolist-column-unpushed-to-pushremote + ("B>P" 3 ,#'magit-repolist-column-unpushed-to-pushremote ((:right-align t) (:sort <))) - ("B>U" 3 magit-repolist-column-unpushed-to-upstream + ("B>U" 3 ,#'magit-repolist-column-unpushed-to-upstream ((:right-align t) (:sort <))) - ("S" 3 magit-repolist-column-stashes + ("S" 3 ,#'magit-repolist-column-stashes ((:right-align t) (:sort <))) - ("B" 3 magit-repolist-column-branches + ("B" 3 ,#'magit-repolist-column-branches ((:right-align t) (:sort <)))) "List of columns displayed by `magit-list-submodules'. @@ -179,8 +183,8 @@ and also setting this variable to t will lead to tears." ("f" "Fetch modules" magit-fetch-modules)]) (defun magit-submodule-arguments (&rest filters) - (--filter (and (member it filters) it) - (transient-args 'magit-submodule))) + (seq-filter (##and (member % filters) %) + (transient-args 'magit-submodule))) (defclass magit--git-submodule-suffix (transient-suffix) ()) @@ -214,26 +218,20 @@ it is nil, then PATH also becomes the name." (interactive (magit-with-toplevel (let* ((url (magit-read-string-ns "Add submodule (remote url)")) - (path (let ((read-file-name-function - (if (or (eq read-file-name-function 'ido-read-file-name) - (advice-function-member-p - 'ido-read-file-name - read-file-name-function)) - ;; The Ido variant doesn't work properly here. - #'read-file-name-default - read-file-name-function))) - (directory-file-name - (file-relative-name - (read-directory-name - "Add submodules at path: " nil nil nil - (and (string-match "\\([^./]+\\)\\(\\.git\\)?$" url) - (match-string 1 url)))))))) + (path (magit-submodule-read-path "Add submodules at path: " url))) (list url (directory-file-name path) (magit-submodule-read-name-for-path path) (magit-submodule-arguments "--force"))))) (magit-submodule-add-1 url path name args)) +(defun magit-submodule-read-path (prompt url) + (directory-file-name + (file-relative-name + (read-directory-name prompt nil nil nil + (and (string-match "\\([^./]+\\)\\(\\.git\\)?$" url) + (match-string 1 url)))))) + (defun magit-submodule-add-1 (url &optional path name args) (magit-with-toplevel (magit-submodule--maybe-reuse-gitdir name path) @@ -258,10 +256,10 @@ it is nil, then PATH also becomes the name." (push (if prefer-short path name) minibuffer-history) (magit-read-string-ns "Submodule name" nil (cons 'minibuffer-history 2) - (or (--keep (pcase-let ((`(,var ,val) (split-string it "="))) - (and (equal val path) - (cadr (split-string var "\\.")))) - (magit-git-lines "config" "--list" "-f" ".gitmodules")) + (or (seq-keep (##pcase-let ((`(,var ,val) (split-string % "="))) + (and (equal val path) + (cadr (split-string var "\\.")))) + (magit-git-lines "config" "--list" "-f" ".gitmodules")) (if prefer-short name path))))) ;;;###autoload (autoload 'magit-submodule-register "magit-submodule" nil t) @@ -416,9 +414,9 @@ to recover from making a mistake here, but don't count on it." (when modules (let ((alist (and trash-gitdirs - (--map (split-string it "\0") - (magit-git-lines "submodule" "foreach" "-q" - "printf \"$sm_path\\0$name\n\""))))) + (mapcar (##split-string % "\0") + (magit-git-lines "submodule" "foreach" "-q" + "printf \"$sm_path\\0$name\n\""))))) (magit-git "submodule" "absorbgitdirs" "--" modules) (magit-git "submodule" "deinit" args "--" modules) (magit-git "rm" args "--" modules) @@ -519,9 +517,9 @@ or, failing that, the abbreviated HEAD commit hash." :doc "Keymap for `module' sections." "C-j" #'magit-submodule-visit "C-" #'magit-submodule-visit - " " #'magit-unstage - " " #'magit-stage - " " #'magit-submodule-visit + " " #'magit-unstage + " " #'magit-stage + " " #'magit-submodule-visit "<5>" (magit-menu-item "Module commands..." #'magit-submodule) "<4>" '(menu-item "--") "<3>" (magit-menu-item "Unstage %T" #'magit-unstage diff --git a/elpa/magit-20250107.2324/magit-subtree.el b/elpa/magit-20250519.1537/magit-subtree.el similarity index 94% rename from elpa/magit-20250107.2324/magit-subtree.el rename to elpa/magit-20250519.1537/magit-subtree.el index a46e5967..b771a23e 100644 --- a/elpa/magit-20250107.2324/magit-subtree.el +++ b/elpa/magit-20250519.1537/magit-subtree.el @@ -20,6 +20,13 @@ ;; You should have received a copy of the GNU General Public License ;; along with Magit. If not, see . +;;; Commentary: + +;; This library implements support for "git subtree". +;; The entry point is the `magit-subtree' menu command. + +;; See (info "(magit)Subtree"). + ;;; Code: (require 'magit) @@ -75,7 +82,6 @@ (topdir (magit-toplevel)) (prefix (read-directory-name (concat prompt ": ") topdir default))) (if (file-name-absolute-p prefix) - ;; At least `ido-mode's variant is not compatible. (if (string-prefix-p topdir prefix) (file-relative-name prefix topdir) (user-error "%s isn't inside the repository at %s" prefix topdir)) @@ -107,14 +113,14 @@ :reader #'magit-transient-read-revision) (defun magit-subtree-prefix (transient prompt) - (if-let ((arg (--first (string-prefix-p "--prefix=" it) - (transient-args transient)))) + (if-let ((arg (seq-find (##string-prefix-p "--prefix=" %) + (transient-args transient)))) (substring arg 9) (magit-subtree-read-prefix prompt))) (defun magit-subtree-arguments (transient) - (--remove (string-prefix-p "--prefix=" it) - (transient-args transient))) + (seq-remove (##string-prefix-p "--prefix=" %) + (transient-args transient))) (defun magit-git-subtree (subcmd prefix &rest args) (magit-run-git-async "subtree" subcmd (concat "--prefix=" prefix) args)) diff --git a/elpa/magit-20250107.2324/magit-tag.el b/elpa/magit-20250519.1537/magit-tag.el similarity index 99% rename from elpa/magit-20250107.2324/magit-tag.el rename to elpa/magit-20250519.1537/magit-tag.el index 4ca8855e..78c87b27 100644 --- a/elpa/magit-20250107.2324/magit-tag.el +++ b/elpa/magit-20250519.1537/magit-tag.el @@ -114,7 +114,7 @@ defaulting to the tag at point. (when tags (magit-call-git "tag" "-d" tags)) (when remote-tags - (magit-run-git-async "push" remote (--map (concat ":" it) remote-tags)))) + (magit-run-git-async "push" remote (mapcar (##concat ":" %) remote-tags)))) (defvar magit-tag-version-regexp-alist '(("^[-._+ ]?snapshot\\.?$" . -4) diff --git a/elpa/magit-20250107.2324/magit-transient.el b/elpa/magit-20250519.1537/magit-transient.el similarity index 73% rename from elpa/magit-20250107.2324/magit-transient.el rename to elpa/magit-20250519.1537/magit-transient.el index aaaca233..7ebd10cd 100644 --- a/elpa/magit-20250107.2324/magit-transient.el +++ b/elpa/magit-20250519.1537/magit-transient.el @@ -93,19 +93,27 @@ (let ((choices (oref obj choices))) (when (functionp choices) (setq choices (funcall choices))) - (if-let ((value (oref obj value))) - (cadr (member value choices)) - (car choices)))) + (if current-prefix-arg + (pcase-let* + ((`(,fallback . ,choices) + (magit--git-variable-list-choices obj)) + (choice (magit-completing-read + (format "Set `%s' to" (oref obj variable)) + (if fallback (nconc choices (list fallback)) choices) + nil t))) + (if (equal choice fallback) nil choice)) + (if-let ((value (oref obj value))) + (cadr (member value choices)) + (car choices))))) ;;;; Readers (defun magit-transient-read-person (prompt initial-input history) (magit-completing-read prompt - (mapcar (lambda (line) - (save-excursion - (and (string-match "\\`[\s\t]+[0-9]+\t" line) - (list (substring line (match-end 0)))))) + (mapcar (##save-excursion + (and (string-match "\\`[\s\t]+[0-9]+\t" %) + (list (substring % (match-end 0))))) (magit-git-lines "shortlog" "-n" "-s" "-e" "HEAD")) nil nil initial-input history)) @@ -151,9 +159,8 @@ (if-let ((value (oref obj value))) (if (oref obj multi-value) (if (cdr value) - (mapconcat (lambda (v) - (concat "\n " - (propertize v 'face 'transient-value))) + (mapconcat (##concat "\n " + (propertize % 'face 'transient-value)) value "") (propertize (car value) 'face 'transient-value)) (propertize (car (split-string value "\n")) @@ -165,6 +172,16 @@ (propertize "unset" 'face 'transient-inactive-value)))) (cl-defmethod transient-format-value ((obj magit--git-variable:choices)) + (pcase-let ((`(,fallback . ,choices) (magit--git-variable-list-choices obj))) + (concat + (propertize "[" 'face 'transient-inactive-value) + (mapconcat #'identity choices + (propertize "|" 'face 'transient-inactive-value)) + (and fallback (propertize "|" 'face 'transient-inactive-value)) + fallback + (propertize "]" 'face 'transient-inactive-value)))) + +(defun magit--git-variable-list-choices (obj) (let* ((variable (oref obj variable)) (choices (oref obj choices)) (globalp (oref obj global)) @@ -182,42 +199,35 @@ (setq global nil)) (when (functionp choices) (setq choices (funcall choices))) - (concat - (propertize "[" 'face 'transient-inactive-value) - (mapconcat (lambda (choice) - (propertize choice 'face (if (equal choice value) - (if (member choice choices) - 'transient-value - 'font-lock-warning-face) - 'transient-inactive-value))) - (if (and value (not (member value choices))) - (cons value choices) - choices) - (propertize "|" 'face 'transient-inactive-value)) - (and (or global fallback default) - (concat - (propertize "|" 'face 'transient-inactive-value) - (cond (global - (propertize (concat "global:" global) - 'face (cond (value - 'transient-inactive-value) - ((member global choices) - 'transient-value) - (t - 'font-lock-warning-face)))) - (fallback - (propertize fallback - 'face (if value - 'transient-inactive-value - 'transient-value))) - (default - (propertize (if (functionp defaultp) - (concat "dwim:" default) - (concat "default:" default)) - 'face (if value - 'transient-inactive-value - 'transient-value)))))) - (propertize "]" 'face 'transient-inactive-value)))) + (cons (cond (global + (propertize (concat "global:" global) + 'face (cond (value + 'transient-inactive-value) + ((member global choices) + 'transient-value) + (t + 'font-lock-warning-face)))) + (fallback + (propertize fallback + 'face (if value + 'transient-inactive-value + 'transient-value))) + (default + (propertize (if (functionp defaultp) + (concat "dwim:" default) + (concat "default:" default)) + 'face (if value + 'transient-inactive-value + 'transient-value)))) + (mapcar (lambda (choice) + (propertize choice 'face (if (equal choice value) + (if (member choice choices) + 'transient-value + 'font-lock-warning-face) + 'transient-inactive-value))) + (if (and value (not (member value choices))) + (cons value choices) + choices))))) ;;; Utilities diff --git a/elpa/magit-20250107.2324/magit-wip.el b/elpa/magit-20250519.1537/magit-wip.el similarity index 94% rename from elpa/magit-20250107.2324/magit-wip.el rename to elpa/magit-20250519.1537/magit-wip.el index 50cf8167..712b7845 100644 --- a/elpa/magit-20250107.2324/magit-wip.el +++ b/elpa/magit-20250519.1537/magit-wip.el @@ -40,41 +40,12 @@ :group 'magit-modes :group 'magit-essentials) -(defgroup magit-wip-legacy nil - "It is better to not use these modes individually." - :link '(info-link "(magit)Legacy Wip Modes") - :group 'magit-wip) - (defcustom magit-wip-mode-lighter " Wip" "Lighter for Magit-Wip mode." :package-version '(magit . "2.90.0") :group 'magit-wip :type 'string) -(defcustom magit-wip-after-save-local-mode-lighter "" - "Lighter for Magit-Wip-After-Save-Local mode." - :package-version '(magit . "2.1.0") - :group 'magit-wip-legacy - :type 'string) - -(defcustom magit-wip-after-apply-mode-lighter "" - "Lighter for Magit-Wip-After-Apply mode." - :package-version '(magit . "2.1.0") - :group 'magit-wip-legacy - :type 'string) - -(defcustom magit-wip-before-change-mode-lighter "" - "Lighter for Magit-Wip-Before-Change mode." - :package-version '(magit . "2.1.0") - :group 'magit-wip-legacy - :type 'string) - -(defcustom magit-wip-initial-backup-mode-lighter "" - "Lighter for Magit-Wip-Initial Backup mode." - :package-version '(magit . "2.1.0") - :group 'magit-wip-legacy - :type 'string) - (defcustom magit-wip-merge-branch nil "Whether to merge the current branch into its wip ref. @@ -138,7 +109,6 @@ the current branch. This mode should be enabled globally by turning on the globalized variant `magit-wip-after-save-mode'." :package-version '(magit . "2.1.0") - :lighter magit-wip-after-save-local-mode-lighter (if magit-wip-after-save-local-mode (if (and buffer-file-name (magit-inside-worktree-p t)) (add-hook 'after-save-hook #'magit-wip-commit-buffer-file t t) @@ -205,7 +175,6 @@ in the worktree and the other contains snapshots of the entries in the index." :package-version '(magit . "2.1.0") :group 'magit-wip - :lighter magit-wip-after-apply-mode-lighter :global t) (defun magit-wip-commit-after-apply (&optional files msg) @@ -227,7 +196,6 @@ Only changes to files which could potentially be affected by the command which is about to be called are committed." :package-version '(magit . "2.1.0") :group 'magit-wip - :lighter magit-wip-before-change-mode-lighter :global t) (defun magit-wip-commit-before-change (&optional files msg) @@ -239,7 +207,6 @@ command which is about to be called are committed." "Before saving a buffer for the first time, commit to a wip ref." :package-version '(magit . "2.90.0") :group 'magit-wip - :lighter magit-wip-initial-backup-mode-lighter :global t (if magit-wip-initial-backup-mode (add-hook 'before-save-hook #'magit-wip-commit-initial-backup) @@ -468,6 +435,27 @@ many \"branches\" of each wip ref are shown." (cl-decf count)) (cons wipref (nreverse tips))))) +(defun magit-wip-purge () + "Ask to delete all wip-refs that no longer have a corresponding ref." + (interactive) + (if-let ((wiprefs (thread-last + (cl-set-difference (magit-list-refs "refs/wip/") + (magit-list-refs) + :test (##equal (substring %1 15) %2)) + (delete "refs/wip/index/HEAD") + (delete "refs/wip/wtree/HEAD")))) + (progn + (magit-confirm 'purge-dangling-wiprefs + "Delete wip-ref %s without corresponding ref" + "Delete %d wip-refs without corresponding ref" + nil wiprefs) + (message "Deleting wip-refs...") + (dolist (wipref wiprefs) + (magit-call-git "update-ref" "-d" wipref)) + (message "Deleting wip-refs...done") + (magit-refresh)) + (message "All wip-refs have a corresponding ref"))) + ;;; _ (provide 'magit-wip) ;;; magit-wip.el ends here diff --git a/elpa/magit-20250107.2324/magit-worktree.el b/elpa/magit-20250519.1537/magit-worktree.el similarity index 98% rename from elpa/magit-20250107.2324/magit-worktree.el rename to elpa/magit-20250519.1537/magit-worktree.el index c55b1787..f38cad52 100644 --- a/elpa/magit-20250107.2324/magit-worktree.el +++ b/elpa/magit-20250519.1537/magit-worktree.el @@ -113,7 +113,7 @@ The primary worktree cannot be deleted." (user-error "Deleting %s would delete the shared .git directory" worktree) (let ((primary (file-name-as-directory (caar (magit-list-worktrees))))) (magit-confirm-files (if magit-delete-by-moving-to-trash 'trash 'delete) - (list "worktree")) + (list worktree)) (when (file-exists-p worktree) (let ((delete-by-moving-to-trash magit-delete-by-moving-to-trash)) (delete-directory worktree t magit-delete-by-moving-to-trash))) @@ -178,7 +178,7 @@ If there is only one worktree, then insert nothing." (bare "(bare)")) config))) worktrees)) - (align (1+ (apply #'max (--map (string-width (car it)) cols))))) + (align (1+ (apply #'max (mapcar (##string-width (car %)) cols))))) (pcase-dolist (`(,head . ,config) cols) (magit--insert-worktree config diff --git a/elpa/magit-20250107.2324/magit.el b/elpa/magit-20250519.1537/magit.el similarity index 96% rename from elpa/magit-20250107.2324/magit.el rename to elpa/magit-20250519.1537/magit.el index 58272a0b..3eb52650 100644 --- a/elpa/magit-20250107.2324/magit.el +++ b/elpa/magit-20250519.1537/magit.el @@ -17,15 +17,15 @@ ;; Homepage: https://github.com/magit/magit ;; Keywords: git tools vc -;; Package-Version: 20250107.2324 -;; Package-Revision: 8b6bb7c7e88c +;; Package-Version: 20250519.1537 +;; Package-Revision: 9b81df36b4eb ;; Package-Requires: ( ;; (emacs "27.1") -;; (compat "30.0.1.0") -;; (dash "2.19.1") -;; (magit-section "4.2.0") +;; (compat "30.1.0.0") +;; (llama "0.6.2") +;; (magit-section "4.3.5") ;; (seq "2.24") -;; (transient "0.8.2") +;; (transient "0.8.8") ;; (with-editor "3.4.3")) ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -194,7 +194,7 @@ and/or `magit-branch-remote-head'." (defface magit-keyword-squash '((t :inherit font-lock-warning-face)) - "Face for squash! and fixup! keywords in commit messages." + "Face for squash! and similar keywords in commit messages." :group 'magit-faces) (defface magit-signature-good @@ -259,20 +259,20 @@ the current Emacs session. If the value is nil, no bindings are added. -If `default', maybe add: +If \\+`default', maybe add: - C-x g `magit-status' - C-x M-g `magit-dispatch' - C-c M-g `magit-file-dispatch' + \\`C-x' \\`g' `magit-status' + \\`C-x' \\`M-g' `magit-dispatch' + \\`C-c' \\`M-g' `magit-file-dispatch' If `recommended', maybe add: - C-x g `magit-status' - C-c g `magit-dispatch' - C-c f `magit-file-dispatch' + \\`C-x' \\`g' `magit-status' + \\`C-c' \\`g' `magit-dispatch' + \\`C-c' \\`f' `magit-file-dispatch' These bindings are strongly recommended, but we cannot use - them by default, because the \"C-c \" namespace is + them by default, because the \\`C-c ' namespace is strictly reserved for bindings added by the user. The bindings in the chosen set may be added when @@ -440,7 +440,7 @@ This affects `magit-git-command', `magit-git-command-topdir', (defun magit-git-command (command) "Execute COMMAND asynchronously; display output. -Interactively, prompt for COMMAND in the minibuffer. \"git \" is +Interactively, prompt for COMMAND in the minibuffer. \"git \" is used as initial input, but can be deleted to run another command. With a prefix argument COMMAND is run in the top-level directory @@ -452,7 +452,7 @@ of the current working tree, otherwise in `default-directory'." (defun magit-git-command-topdir (command) "Execute COMMAND asynchronously; display output. -Interactively, prompt for COMMAND in the minibuffer. \"git \" is +Interactively, prompt for COMMAND in the minibuffer. \"git \" is used as initial input, but can be deleted to run another command. COMMAND is run in the top-level directory of the current @@ -502,13 +502,22 @@ is run in the top-level directory of the current working tree." ;;; Shared Infix Arguments +(transient-define-argument magit:--signoff () + :description "Add Signed-off-by trailer" + :class 'transient-switch + :key "+s" + :shortarg "-s" + :argument "--signoff" + :level 6) + (transient-define-argument magit:--gpg-sign () :description "Sign using gpg" :class 'transient-option :shortarg "-S" :argument "--gpg-sign=" :allow-empty t - :reader #'magit-read-gpg-signing-key) + :reader #'magit-read-gpg-signing-key + :level 5) (defvar magit-gpg-secret-key-hist nil) @@ -562,6 +571,7 @@ is run in the top-level directory of the current working tree." (1 'font-lock-keyword-face) (2 'font-lock-function-name-face nil t)) (,(concat "(" (regexp-opt '("magit-insert-section" + "magit-insert-heading" "magit-section-case" "magit-bind-match-strings" "magit-with-temp-index" @@ -773,6 +783,7 @@ For X11 something like ~/.xinitrc should work.\n" (require 'magit-gitignore) (require 'magit-sparse-checkout) (require 'magit-extras) + (require 'magit-dired) (require 'git-rebase) (require 'magit-bookmark))) diff --git a/elpa/magit-20250107.2324/magit.info b/elpa/magit-20250519.1537/magit.info similarity index 95% rename from elpa/magit-20250107.2324/magit.info rename to elpa/magit-20250519.1537/magit.info index 05aaf72a..efd5f29c 100644 --- a/elpa/magit-20250107.2324/magit.info +++ b/elpa/magit-20250519.1537/magit.info @@ -32,7 +32,7 @@ to perform almost all of their daily version control tasks directly from within Emacs. While many fine Git clients exist, only Magit and Git itself deserve to be called porcelains. -This manual is for Magit version 4.2.0. +This manual is for Magit version 4.3.5. Copyright (C) 2015-2025 Jonas Bernoulli @@ -292,7 +292,8 @@ File: magit.info, Node: Installing from the Git Repository, Next: Post-Install 2.2 Installing from the Git Repository ====================================== -Magit depends on the ‘compat’, ‘dash’, ‘transient’ and ‘with-editor’ +Magit depends on the ‘compat’, ‘llama’, ‘seq’ (the built-in version is +enough when using Emacs >= 29.1), ‘transient’ and ‘with-editor’ libraries which are available from Melpa and Melpa-Stable. Install them using ‘M-x package-install RET RET’. Of course you may also install them manually from their repository. @@ -306,17 +307,18 @@ install them manually from their repository. $ make - If you haven’t installed ‘compat’, ‘dash’, ‘transient’ and -‘with-editor’ from Melpa or at ‘/path/to/magit/../’, then you -have to tell ‘make’ where to find them. To do so create the file -‘/path/to/magit/config.mk’ with the following content before running -‘make’: + If you haven’t installed ‘compat’, ‘llama’, ‘seq’ (for Emacs < 29.1), +‘transient’ and ‘with-editor’ from Melpa, or at +‘/path/to/magit/../’, then you have to tell ‘make’ where to +find them. To do so create the file ‘/path/to/magit/config.mk’ with the +following content before running ‘make’: LOAD_PATH = -L ~/.emacs.d/site-lisp/magit/lisp - LOAD_PATH += -L ~/.emacs.d/site-lisp/dash + LOAD_PATH += -L ~/.emacs.d/site-lisp/compat + LOAD_PATH += -L ~/.emacs.d/site-lisp/llama + LOAD_PATH += -L ~/.emacs.d/site-lisp/seq LOAD_PATH += -L ~/.emacs.d/site-lisp/transient/lisp LOAD_PATH += -L ~/.emacs.d/site-lisp/with-editor/lisp - LOAD_PATH += -L ~/.emacs.d/site-lisp/compat Finally add this to your init file: @@ -325,13 +327,14 @@ have to tell ‘make’ where to find them. To do so create the file (with-eval-after-load 'info (info-initialize) - (add-to-list 'Info-directory-list - "~/.emacs.d/site-lisp/magit/Documentation/")) + (add-to-list 'Info-directory-list "~/.emacs.d/site-lisp/magit/docs/")) Of course if you installed the dependencies manually as well, then you have to tell Emacs about them too, by prefixing the above with: - (add-to-list 'load-path "~/.emacs.d/site-lisp/dash") + (add-to-list 'load-path "~/.emacs.d/site-lisp/compat") + (add-to-list 'load-path "~/.emacs.d/site-lisp/llama") + (add-to-list 'load-path "~/.emacs.d/site-lisp/seq") (add-to-list 'load-path "~/.emacs.d/site-lisp/transient/lisp") (add-to-list 'load-path "~/.emacs.d/site-lisp/with-editor") @@ -2314,11 +2317,16 @@ The contents of status buffers is controlled using the hook such hooks and how to customize them. -- User Option: magit-status-sections-hook - Hook run to insert sections into a status buffer. + This hook is run to insert sections into a status buffer. + + The functions described in this section, and the functions + ‘magit-insert-status-headers’ and ‘magit-insert-untracked-files’, + which are described in subsequent sections, are members of this + hook. - The first function on that hook by default is -‘magit-insert-status-headers’; it is described in the next section. By -default the following functions are also members of that hook: + Some additional functions that can be added to this hook, but are + by default added to another hooks, are listed in *note References + Buffer::. -- Function: magit-insert-merge-log Insert section for the on-going merge. Display the heads that are @@ -2345,17 +2353,6 @@ default the following functions are also members of that hook: -- Function: magit-insert-bisect-log While bisecting, insert section logging bisect progress. - -- Function: magit-insert-untracked-files - Maybe insert a list or tree of untracked files. - - The option ‘magit-status-show-untracked-files’ (which see), in - cooperation with the Git variable ‘status.showUntrackedFiles’, - control whether and how that is done. - - If the first element of ‘magit-buffer-diff-files’ is a directory, - then limit the list to files below that. The value of that - variable can be set using ‘D -- DIRECTORY RET g’. - -- Function: magit-insert-unstaged-changes Insert section showing unstaged changes. @@ -2384,31 +2381,73 @@ default the following functions are also members of that hook: Insert section showing commits that haven’t been pushed to the push-remote yet. - The following functions can also be added to the above hook: +5.1.2 Status File List Sections +------------------------------- + +These functions honor the buffer’s file filter, which can be set using +‘D - -’. + + -- Function: magit-insert-untracked-files + This function may insert a list of untracked files. Whether it + actually does so, depends on the option described next. + + -- User Option: magit-status-show-untracked-files + This option controls whether the above function inserts a list of + untracked files in the status buffer. + + • If ‘nil’, do not list any untracked files. + • If ‘t’, list untracked files, but if a directory does not + contain any untracked files, then only list that directory, + not the contained untracked files. + • If ‘all’, then list each individual untracked files. This is + can be very slow and is discouraged. + + The corresponding values for the Git variable are "no", "normal" + and "all". + + To disable listing untracked files in a specific repository only, + add the following to ‘.dir-locals.el’: + + ((magit-status-mode + (magit-status-show-untracked-files . "no"))) + + Alternatively (and mostly for historic reasons), it is possible to + use ‘git config’ to set the repository-local value: + + git config set --local status.showUntrackedFiles no + + This does *not* override the (if any) local value of this Lisp + variable, but it does override its global value. + + See the last section in the git-status(1) manpage, to speed up the + part of the work Git is responsible for. Turning that list into + sections is also not free, so Magit only lists + ‘magit-status-file-list-limit’ files. + + -- User Option: magit-status-file-list-limit + This option controls many files are listed at most in each section + that lists files in the status buffer. For performance reasons, it + is recommended that you do not increase this limit. + + While the above function is a member of ‘magit-status-section-hook’ +by default, the following functions have to be explicitly added by the +user. Because that negatively affects performance, it is recommended +that you don’t do that. -- Function: magit-insert-tracked-files - Insert a tree of tracked files. + Insert a list of tracked files. -- Function: magit-insert-ignored-files - Insert a tree of ignored files. Its possible to limit the logs in - the current buffer to a certain directory using ‘D = f - RET g’. If you do that, then that that also affects this command. - - The log filter can be used to limit to multiple files. In that - case this function only respects the first of the files and only if - it is a directory. + Insert a list of ignored files. -- Function: magit-insert-skip-worktree-files - Insert a tree of skip-worktree files. If the first element of - ‘magit-buffer-diff-files’ is a directory, then limit the list to - files below that. The value of that variable can be set using ‘D - -- DIRECTORY RET g’. + Insert a list of skip-worktree files. -- Function: magit-insert-assumed-unchanged-files - Insert a tree of files that are assumed to be unchanged. If the - first element of ‘magit-buffer-diff-files’ is a directory, then - limit the list to files below that. The value of that variable can - be set using ‘D -- DIRECTORY RET g’. + Insert a list of files that are assumed to be unchanged. + +5.1.3 Status Log Sections +------------------------- -- Function: magit-insert-unpulled-or-recent-commits Insert section showing unpulled or recent commits. If an upstream @@ -2438,10 +2477,7 @@ default the following functions are also members of that hook: not shared with any upstream commit) with "+" and all others with "-". - See *note References Buffer:: for some more section inserters, which -could be used here. - -5.1.2 Status Header Sections +5.1.4 Status Header Sections ---------------------------- The contents of status buffers is controlled using the hook @@ -2506,7 +2542,7 @@ hook variable. -- Function: magit-insert-user-header Insert a header line about the current user. -5.1.3 Status Module Sections +5.1.5 Status Module Sections ---------------------------- The contents of status buffers is controlled using the hook @@ -2563,7 +2599,7 @@ variable. push-remote yet. These sections can be expanded to show the respective commits. -5.1.4 Status Options +5.1.6 Status Options -------------------- -- User Option: magit-status-margin @@ -3472,6 +3508,14 @@ they are available here too. ‘--stat-graph-width’ and ‘--compact-summary’. Also see *note (gitman)git-diff::. + -- User Option: magit-format-file-function + This function is used to format lines representing a file. It is + used for file headings in diffs, in diffstats and for lists of + files (such as the untracked files). Depending on the caller, it + receives either three or five arguments; the signature has to be + ‘(kind file face &optional status orig)’. KIND is one of ‘diff’, + ‘module’, ‘stat’ and ‘list’. + 5.4.4 Revision Buffer --------------------- @@ -4030,12 +4074,9 @@ These commands can only be used when point is inside a diff. ‘’ (‘magit-diff-visit-file’) This command visits the appropriate version of the file that the - diff at point is about. - - This commands visits the worktree version of the appropriate file. - The location of point inside the diff determines which file is - being visited. The visited version depends on what changes the - diff is about. + diff at point is about. The location of point inside the diff + determines which file is being visited. The visited version + depends on what changes the diff is about. 1. If the diff shows uncommitted changes (i.e., staged or unstaged changes), then visit the file in the working tree @@ -4606,12 +4647,14 @@ File: magit.info, Node: Committing, Next: Branching, Prev: Applying, Up: Man 6.5 Committing ============== -When the user initiates a commit, Magit calls ‘git commit’ without any -arguments, so Git has to get it from the user. It creates the file -‘.git/COMMIT_EDITMSG’ and then opens that file in an editor. Magit -arranges for that editor to be the Emacsclient. Once the user finishes -the editing session, the Emacsclient exits and Git creates the commit -using the file’s content as message. +When the user initiates a commit, Magit calls ‘git commit’ without the +‘--message’ argument, so Git has to get the message from the user. To +do so, it creates a file such as ‘.git/COMMIT_EDITMSG’ and then opens +that file in the editor specified by ‘$EDITOR’ (or ‘$GIT_EDITOR’). + + Magit arranges for that editor to be the Emacsclient. Once the user +finishes the editing session, the Emacsclient exits and Git creates the +commit, using the file’s content as the commit message. 6.5.1 Initiating a Commit ------------------------- @@ -4623,115 +4666,268 @@ Also see *note (gitman)git-commit::. along with the appropriate infix arguments and displays them in a temporary buffer until a suffix is invoked. +Creating a new commit +..................... + ‘c c’ (‘magit-commit-create’) - Create a new commit on ‘HEAD’. With a prefix argument amend to the - commit at ‘HEAD’ instead. + Create a new commit. -‘c a’ (‘magit-commit-amend’) - Amend the last commit. +Editing the last commit +....................... + +These commands modify the last (a.k.a., "HEAD") commit. The commit is +modified (a.k.a., replaced) immediately. Similar commands exist for +modifying other (non-HEAD) commits. Those commands are described in the +following two sections. For each command in this section, we mention +the respective non-HEAD commands, to make the relation explicit. + + The command descriptions below mention the specific arguments they +use when calling ‘git commit’. The arguments specified in the menu are +appended to those arguments. ‘c e’ (‘magit-commit-extend’) - Amend the last commit, without editing the message. With a prefix - argument keep the committer date, otherwise change it. The option - ‘magit-commit-extend-override-date’ can be used to inverse the - meaning of the prefix argument. + This command amends the staged changes to the last commit, without + editing its commit message. - Non-interactively respect the optional OVERRIDE-DATE argument and - ignore the option. + This command calls ‘git commit --amend --no-edit’. -‘c w’ (‘magit-commit-reword’) - Reword the last commit, ignoring staged changes. With a prefix - argument keep the committer date, otherwise change it. The option - ‘magit-commit-reword-override-date’ can be used to inverse the - meaning of the prefix argument. + With a prefix argument the committer date is not updated; without + an argument it is updated. + + The option ‘magit-commit-extend-override-date’ can be used to + inverse the meaning of the prefix argument. Non-interactively, the + optional OVERRIDE-DATE argument controls this behavior, and the + option is of no relevance. + +‘c a’ (‘magit-commit-amend’) + This command amends the staged changes to the last commit, and pops + up a buffer to let the user edit its commit message. - Non-interactively respect the optional OVERRIDE-DATE argument and - ignore the option. + This command calls ‘git commit --amend --edit’. + +‘c w’ (‘magit-commit-reword’) + This command pops up a buffer to let the user edit the message of + the latest commit. The commit tree remains unchanged and staged + changes remain staged. + + This command calls ‘git commit --amend --only --edit’. + + With a prefix argument the committer date is not updated; without + an argument it is updated. + + The option ‘magit-commit-reword-override-date’ can be used to + inverse the meaning of the prefix argument. Non-interactively, the + optional OVERRIDE-DATE argument controls this behavior, and the + option is of no relevance. + +Editing any reachable commit +............................ + +These commands create a new commit, which targets an existing commit, +from the staged changes and/or using a new commit message. Any commit +that is reachable from HEAD, including HEAD itself, can be the target. + + The new commit is intended to be eventually squashed into the +targeted commit, but this is *not* done immediately. The squashing is +done at a later time, when you explicitly call +‘magit-rebase-autosquash’, or use ‘--autosquash’ with another rebase +command. + + Some of these commands require that you immediately write a new +commit message, or that you immediately edit an existing message. + + The new commits are called "squash" and "fixup" commits. The +difference is that when a "squash" commit is squashed into its targeted +commit, the user gets a chance to modify the message to be used for the +final commit; while for "fixup" commits the existing message of the +targeted commit is used as-is and the message of the "fixup" commit is +discarded. + + If point is on a reachable commit, then all of these commands target +that commit, without requiring confirmation. If point is on some +reachable commit, but you want to target another commit, use a prefix +argument, to select a commit in a log buffer dedicated to that task. +The meaning of the prefix argument can be inverted by customizing +‘magit-commit-squash-confirm’. + + The command descriptions below mention the specific arguments they +use when calling ‘git commit’. The arguments specified in the menu are +appended to those arguments. + + The next two commands also exist in "instant" variants, which are +described in the next section. Those variants behave the same as the +variants described here, except that they immediately initiate an +‘--autosquash’ rebase. ‘c f’ (‘magit-commit-fixup’) - Create a fixup commit. + This command creates a new fixup commit from the staged changes, + targeting the reachable commit at point, if any. Otherwise the + user is prompted for a commit. - With a prefix argument the target commit has to be confirmed. - Otherwise the commit at point may be used without confirmation - depending on the value of option ‘magit-commit-squash-confirm’. + Use this variant if you want to correct some minor defect in the + targeted commit, which does not require changes to the existing + message of the targeted commit. -‘c F’ (‘magit-commit-instant-fixup’) - Create a fixup commit and instantly rebase. + This command calls ‘git commit --fixup=COMMIT --no-edit’. ‘c s’ (‘magit-commit-squash’) - Create a squash commit, without editing the squash message. + This command creates a new squash commit from the staged changes, + targeting the reachable commit at point, if any. Otherwise the + user is prompted for a commit. + + Use this variant if you want a chance to make changes to the final + commit message, but not until the two commits are being squashed + into the final combined commit. + + This command calls ‘git commit --squash=COMMIT --no-edit’. + +‘c A’ (‘magit-commit-alter’) + This command creates a new fixup commit from the staged changes, + targeting the reachable commit at point, if any. Otherwise the + user is prompted for a commit. + + Use this variant if you want to write the final commit message now, + but (as for all variants in this section) do not want to + immediately squash the fixup and targeted commits into a final + combined commit. + + This command calls ‘git commit --fixup=amend:COMMIT --edit’. + +‘c n’ (‘magit-commit-augment’) + This command creates a new squash commit from the staged changes, + targeting the reachable commit at point, if any. Otherwise the + user is prompted for a commit. + + Use this variant if you want to describe the new changes now, but + want to delay writing the final message, which describes the + changes in the combined commit, until you actually combine the + squash and target commits into the final commit. You can think of + the new message, which you write here, as a "note", to be + integrated once once you write the final commit message. + + This command calls ‘git commit --squash=COMMIT --edit’. + +‘c W’ (‘magit-commit-revise’) + This command pops up a buffer containing the commit message of the + reachable commit at point, if any. Otherwise the user is prompted + for a commit to target. + + Use this variant if you want to correct the message of the targeted + commit, but want to delay performing the ‘--autosquash’ rebase, + which actually changes that commit. + + This command calls ‘git commit --fixup=reword:COMMIT --edit’. + +Editing any reachable commit and rebasing immediately +..................................................... + +These commands create a new commit, which targets an existing commit, +from the staged changes. Any commit that is reachable from HEAD, +including HEAD itself, can be the target. + + The new commit is immediately squashed into its target commit, using +an ‘--autosquash’ rebase. + + The command descriptions below mention the specific arguments they +use when calling ‘git commit’. The arguments specified in the menu are +appended to those arguments when calling ‘git commit’. + +‘c F’ (‘magit-commit-instant-fixup’) + This command creates a fixup commit, targeting the reachable commit + at point, if any. Otherwise the user is prompted for a commit. + Then it instantly performs a rebase, to squash the new commit into + the targeted commit. + + The original commit message of the targeted commit is left + untouched. - With a prefix argument the target commit has to be confirmed. - Otherwise the commit at point may be used without confirmation - depending on the value of option ‘magit-commit-squash-confirm’. + This command calls ‘git commit --fixup=COMMIT --no-edit’ and then + ‘git rebase --autosquash MERGE-BASE’. ‘c S’ (‘magit-commit-instant-squash’) - Create a squash commit and instantly rebase. + This command creates a squash commit, targeting the reachable + commit at point, if any. Otherwise the user is prompted for a + commit. Then it instantly performs a rebase, to squash the new + commit into the targeted commit. -‘c A’ (‘magit-commit-augment’) - Create a squash commit, editing the squash message. + During the rebase phase the user is asked to author the final + commit message, based on the original message of the targeted + commit. - With a prefix argument the target commit has to be confirmed. - Otherwise the commit at point may be used without confirmation - depending on the value of option ‘magit-commit-squash-confirm’. + This command calls ‘git commit --squash=COMMIT --no-edit’ and then + ‘git rebase --autosquash MERGE-BASE’. - -- User Option: magit-commit-ask-to-stage - Whether to ask to stage all unstaged changes when committing and - nothing is staged. +Options used by commit commands +............................... - -- User Option: magit-commit-show-diff - Whether the relevant diff is automatically shown when committing. + • Used by all or most commit commands - -- User Option: magit-commit-extend-override-date - Whether using ‘magit-commit-extend’ changes the committer date. + -- User Option: magit-commit-show-diff + Whether the relevant diff is automatically shown when + committing. - -- User Option: magit-commit-reword-override-date - Whether using ‘magit-commit-reword’ changes the committer date. + -- User Option: magit-commit-ask-to-stage + Whether to ask to stage all unstaged changes when committing + and nothing is staged. - -- User Option: magit-commit-squash-confirm - Whether the commit targeted by squash and fixup has to be - confirmed. When non-nil then the commit at point (if any) is used - as default choice. Otherwise it has to be confirmed. This option - only affects ‘magit-commit-squash’ and ‘magit-commit-fixup’. The - "instant" variants always require confirmation because making an - error while using those is harder to recover from. + -- User Option: magit-post-commit-hook + Hook run after creating a commit without the user editing a + message. - -- User Option: magit-post-commit-hook - Hook run after creating a commit without the user editing a - message. + This hook is run by ‘magit-refresh’ if ‘this-command’ is a + member of ‘magit-post-commit-hook-commands’. This only + includes commands named ‘magit-commit-*’ that do *not* require + that the user edits the commit message in a buffer. + + Also see ‘git-commit-post-finish-hook’. + + -- User Option: magit-commit-diff-inhibit-same-window + Whether to inhibit use of same window when showing diff while + committing. + + When writing a commit, then a diff of the changes to be + committed is automatically shown. The idea is that the diff + is shown in a different window of the same frame and for most + users that just works. In other words most users can + completely ignore this option because its value doesn’t make a + difference for them. + + However for users who configured Emacs to never create a new + window even when the package explicitly tries to do so, then + displaying two new buffers necessarily means that the first is + immediately replaced by the second. In our case the message + buffer is immediately replaced by the diff buffer, which is of + course highly undesirable. - This hook is run by ‘magit-refresh’ if ‘this-command’ is a member - of ‘magit-post-commit-hook-commands’. This only includes commands - named ‘magit-commit-*’ that do *not* require that the user edits - the commit message in a buffer. + A workaround is to suppress this user configuration in this + particular case. Users have to explicitly opt-in by toggling + this option. We cannot enable the workaround unconditionally + because that again causes issues for other users: if the frame + is too tiny or the relevant settings too aggressive, then the + diff buffer would end up being displayed in a new frame. - Also see ‘git-commit-post-finish-hook’. + Also see . - -- User Option: magit-commit-diff-inhibit-same-window - Whether to inhibit use of same window when showing diff while - committing. + • Used by all squash and fixup commands - When writing a commit, then a diff of the changes to be committed - is automatically shown. The idea is that the diff is shown in a - different window of the same frame and for most users that just - works. In other words most users can completely ignore this option - because its value doesn’t make a difference for them. + -- User Option: magit-commit-squash-confirm + Whether the commit targeted by squash and fixup has to be + confirmed. When non-nil then the commit at point (if any) is + used as default choice. Otherwise it has to be confirmed. + This option only affects ‘magit-commit-squash’ and + ‘magit-commit-fixup’. The "instant" variants always require + confirmation because making an error while using those is + harder to recover from. - However for users who configured Emacs to never create a new window - even when the package explicitly tries to do so, then displaying - two new buffers necessarily means that the first is immediately - replaced by the second. In our case the message buffer is - immediately replaced by the diff buffer, which is of course highly - undesirable. + • Used by specific commit commands - A workaround is to suppress this user configuration in this - particular case. Users have to explicitly opt-in by toggling this - option. We cannot enable the workaround unconditionally because - that again causes issues for other users: if the frame is too tiny - or the relevant settings too aggressive, then the diff buffer would - end up being displayed in a new frame. + -- User Option: magit-commit-extend-override-date + Whether using ‘magit-commit-extend’ changes the committer + date. - Also see . + -- User Option: magit-commit-reword-override-date + Whether using ‘magit-commit-reword’ changes the committer + date. 6.5.2 Editing Commit Messages ----------------------------- @@ -5507,7 +5703,7 @@ following suffix commands. the merged branch, then the respective remote branch is also removed. -‘m i’ (‘magit-merge-into’) +‘m d’ (‘magit-merge-dissolve’) This command merges the current branch into another local branch and then removes the former. The latter becomes the new current branch. @@ -5745,6 +5941,11 @@ is not enabled in the transient. This command combines squash and fixup commits with their intended targets. + By default only commits that are not reachable from the upstream + branch are potentially squashed into. If no upstream is configured + or with a prefix argument, the user is prompted for the first + commit to potentially squash into. + ‘r m’ (‘magit-rebase-edit-commit’) This command starts an interactive rebase sequence that lets the user edit a single older commit. @@ -5830,7 +6031,8 @@ following suffix commands. current commit’s message. ‘k’ (‘git-rebase-kill-line’) - Kill the current action line. + Comment the current action line, or if it is already commented, + then uncomment it. ‘c’ (‘git-rebase-pick’) Use commit on current line. @@ -6312,12 +6514,6 @@ Also see *note (gitman)git-stash::. the index, making it impossible to also store the stash’s index there. - First try ‘git stash apply --index’, which tries to preserve the - index stored in the stash, if any. This may fail because applying - the stash could result in conflicts and those have to be stored in - the index, making it impossible to also store the stash’s index - there. - If ‘git stash’ fails, then potentially fall back to using ‘git apply’. If the stash does not touch any unstaged files, then pass ‘--3way’ to that command. Otherwise ask the user whether to use @@ -9255,7 +9451,7 @@ Appendix C Keystroke Index * B: Bisecting. (line 9) * b: Blaming. (line 115) * b <1>: Branching. (line 63) -* b <2>: Rebasing. (line 181) +* b <2>: Rebasing. (line 187) * B B: Bisecting. (line 16) * B b: Bisecting. (line 32) * b b: Branching. (line 97) @@ -9275,50 +9471,52 @@ Appendix C Keystroke Index * b x: Branching. (line 173) * c: Blaming. (line 141) * C: Cloning Repository. (line 20) -* c <1>: Committing. (line 19) -* c <2>: Rebasing. (line 170) +* c <1>: Committing. (line 21) +* c <2>: Rebasing. (line 176) * C >: Cloning Repository. (line 38) -* c a: Committing. (line 28) -* c A: Committing. (line 69) +* c a: Committing. (line 59) +* c A: Committing. (line 141) * C b: Cloning Repository. (line 44) * C C: Cloning Repository. (line 28) -* c c: Committing. (line 24) +* c c: Committing. (line 29) * C d: Cloning Repository. (line 55) * C e: Cloning Repository. (line 61) -* c e: Committing. (line 31) -* c f: Committing. (line 49) -* c F: Committing. (line 56) +* c e: Committing. (line 45) +* c f: Committing. (line 119) +* c F: Committing. (line 192) * C m: Cloning Repository. (line 48) +* c n: Committing. (line 153) * C s: Cloning Repository. (line 32) -* c s: Committing. (line 59) -* c S: Committing. (line 66) -* c w: Committing. (line 40) +* c s: Committing. (line 130) +* c S: Committing. (line 204) +* c w: Committing. (line 65) +* c W: Committing. (line 167) * C-: Visiting Files and Blobs. - (line 81) + (line 78) * C-: Sections. (line 138) -* C-c C-a: Committing. (line 260) +* C-c C-a: Committing. (line 415) * C-c C-b: Logging. (line 116) * C-c C-b <1>: Diffing. (line 173) * C-c C-c: Logging. (line 297) -* C-c C-c <1>: Committing. (line 148) -* C-c C-c <2>: Rebasing. (line 118) +* C-c C-c <1>: Committing. (line 303) +* C-c C-c <2>: Rebasing. (line 123) * C-c C-d: Diffing. (line 164) -* C-c C-d <1>: Committing. (line 184) +* C-c C-d <1>: Committing. (line 339) * C-c C-e: Diffing. (line 199) * C-c C-f: Logging. (line 119) * C-c C-f <1>: Diffing. (line 176) -* C-c C-i: Committing. (line 257) +* C-c C-i: Committing. (line 412) * C-c C-k: Logging. (line 302) -* C-c C-k <1>: Committing. (line 152) -* C-c C-k <2>: Rebasing. (line 122) +* C-c C-k <1>: Committing. (line 307) +* C-c C-k <2>: Rebasing. (line 127) * C-c C-n: Logging. (line 122) -* C-c C-o: Committing. (line 272) -* C-c C-p: Committing. (line 275) -* C-c C-r: Committing. (line 263) -* C-c C-s: Committing. (line 266) +* C-c C-o: Committing. (line 427) +* C-c C-p: Committing. (line 430) +* C-c C-r: Committing. (line 418) +* C-c C-s: Committing. (line 421) * C-c C-t: Diffing. (line 190) -* C-c C-t <1>: Committing. (line 269) -* C-c C-w: Committing. (line 192) +* C-c C-t <1>: Committing. (line 424) +* C-c C-w: Committing. (line 347) * C-c f: Commands for Buffers Visiting Files. (line 52) * C-c f , c: Commands for Buffers Visiting Files. @@ -9448,13 +9646,13 @@ Appendix C Keystroke Index (line 156) * C-c M-g V: Commands for Buffers Visiting Files. (line 160) -* C-c M-i: Committing. (line 279) -* C-c M-s: Committing. (line 163) +* C-c M-i: Committing. (line 434) +* C-c M-s: Committing. (line 318) * C-c TAB: Sections. (line 138) * C-w: Common Commands. (line 22) * C-x g: Status Buffer. (line 23) * C-x M-g: Transient Commands. (line 20) -* C-x u: Rebasing. (line 188) +* C-x u: Rebasing. (line 194) * d: Diffing. (line 22) * D: Diffing. (line 105) * d c: Diffing. (line 82) @@ -9475,10 +9673,10 @@ Appendix C Keystroke Index * DEL: Logging. (line 146) * DEL <1>: Diffing. (line 231) * DEL <2>: Blaming. (line 103) -* DEL <3>: Rebasing. (line 136) +* DEL <3>: Rebasing. (line 141) * e: Ediffing. (line 10) * E: Ediffing. (line 21) -* e <1>: Rebasing. (line 157) +* e <1>: Rebasing. (line 162) * E c: Ediffing. (line 100) * E i: Ediffing. (line 94) * E m: Ediffing. (line 33) @@ -9490,7 +9688,7 @@ Appendix C Keystroke Index * E w: Ediffing. (line 97) * E z: Ediffing. (line 103) * f: Repository List. (line 111) -* f <1>: Rebasing. (line 163) +* f <1>: Rebasing. (line 168) * f <2>: Fetching. (line 10) * F: Pulling. (line 10) * f a: Fetching. (line 45) @@ -9513,13 +9711,13 @@ Appendix C Keystroke Index * j <1>: Diffing. (line 218) * k: Running Git. (line 27) * k <1>: Applying. (line 40) -* k <2>: Rebasing. (line 167) -* k <3>: Stashing. (line 120) +* k <2>: Rebasing. (line 172) +* k <3>: Stashing. (line 114) * l: Logging. (line 28) * L: Logging. (line 75) * L <1>: Logging. (line 103) * L <2>: Logging. (line 263) -* l <1>: Rebasing. (line 205) +* l <1>: Rebasing. (line 211) * l a: Logging. (line 59) * l b: Logging. (line 56) * L d: Logging. (line 277) @@ -9544,8 +9742,8 @@ Appendix C Keystroke Index * m a <1>: Merging. (line 91) * M a: Remotes. (line 51) * M C: Remotes. (line 35) +* m d: Merging. (line 54) * m e: Merging. (line 30) -* m i: Merging. (line 54) * M k: Remotes. (line 63) * m m: Merging. (line 18) * m m <1>: Merging. (line 86) @@ -9562,19 +9760,19 @@ Appendix C Keystroke Index * M-4: Sections. (line 169) * M-: Sections. (line 153) * M-n: Sections. (line 40) -* M-n <1>: Committing. (line 171) -* M-n <2>: Rebasing. (line 151) +* M-n <1>: Committing. (line 326) +* M-n <2>: Rebasing. (line 156) * M-p: Sections. (line 35) -* M-p <1>: Committing. (line 166) -* M-p <2>: Rebasing. (line 148) +* M-p <1>: Committing. (line 321) +* M-p <2>: Rebasing. (line 153) * M-w: Blaming. (line 134) * M-w <1>: Common Commands. (line 39) -* MM: Rebasing. (line 213) -* Mt: Rebasing. (line 219) +* MM: Rebasing. (line 219) +* Mt: Rebasing. (line 225) * n: Sections. (line 32) * n <1>: Blaming. (line 118) * N: Blaming. (line 121) -* n <2>: Rebasing. (line 145) +* n <2>: Rebasing. (line 150) * n <3>: Minor Mode for Buffers Visiting Blobs. (line 16) * o: Submodules. (line 55) @@ -9598,7 +9796,7 @@ Appendix C Keystroke Index * p: Sections. (line 27) * p <1>: Blaming. (line 124) * P: Blaming. (line 127) -* p <2>: Rebasing. (line 142) +* p <2>: Rebasing. (line 147) * P <1>: Pushing. (line 10) * p <3>: Minor Mode for Buffers Visiting Blobs. (line 13) @@ -9617,37 +9815,37 @@ Appendix C Keystroke Index * q <3>: Minor Mode for Buffers Visiting Blobs. (line 19) * r: Rebasing. (line 10) -* r <1>: Rebasing. (line 154) -* r a: Rebasing. (line 111) +* r <1>: Rebasing. (line 159) +* r a: Rebasing. (line 116) * r e: Rebasing. (line 42) -* r e <1>: Rebasing. (line 107) +* r e <1>: Rebasing. (line 112) * r f: Rebasing. (line 79) * r i: Rebasing. (line 76) -* r k: Rebasing. (line 91) -* r m: Rebasing. (line 83) +* r k: Rebasing. (line 96) +* r m: Rebasing. (line 88) * r p: Rebasing. (line 28) -* r r: Rebasing. (line 97) +* r r: Rebasing. (line 102) * r s: Rebasing. (line 47) -* r s <1>: Rebasing. (line 103) +* r s <1>: Rebasing. (line 108) * r u: Rebasing. (line 35) -* r w: Rebasing. (line 87) +* r w: Rebasing. (line 92) * RET: Repository List. (line 102) * RET <1>: References Buffer. (line 159) * RET <2>: Visiting Files and Blobs. (line 40) * RET <3>: Blaming. (line 91) -* RET <4>: Rebasing. (line 126) +* RET <4>: Rebasing. (line 131) * s: Staging and Unstaging. (line 29) * S: Staging and Unstaging. (line 36) -* s <1>: Rebasing. (line 160) +* s <1>: Rebasing. (line 165) * S-: Sections. (line 157) * SPC: Logging. (line 137) * SPC <1>: Diffing. (line 228) * SPC <2>: Blaming. (line 94) -* SPC <3>: Rebasing. (line 130) -* t: Rebasing. (line 208) +* SPC <3>: Rebasing. (line 135) +* t: Rebasing. (line 214) * t <1>: Tagging. (line 9) * T: Notes. (line 9) * T a: Notes. (line 47) @@ -9684,7 +9882,7 @@ Appendix C Keystroke Index * w s: Maildir Patches. (line 34) * w w: Maildir Patches. (line 14) * w w <1>: Maildir Patches. (line 31) -* x: Rebasing. (line 173) +* x: Rebasing. (line 179) * x <1>: Resetting. (line 9) * X f: Resetting. (line 44) * X h: Resetting. (line 24) @@ -9696,7 +9894,7 @@ Appendix C Keystroke Index * X w <1>: Wip Modes. (line 64) * Y: Logging. (line 382) * y: References Buffer. (line 7) -* y <1>: Rebasing. (line 185) +* y <1>: Rebasing. (line 191) * y c: References Buffer. (line 25) * y o: References Buffer. (line 30) * y r: References Buffer. (line 34) @@ -9704,20 +9902,20 @@ Appendix C Keystroke Index * z: Stashing. (line 9) * Z: Worktree. (line 9) * z a: Stashing. (line 52) -* z b: Stashing. (line 107) -* z B: Stashing. (line 112) +* z b: Stashing. (line 101) +* z B: Stashing. (line 106) * Z b: Worktree. (line 13) * Z c: Worktree. (line 16) -* z f: Stashing. (line 117) +* z f: Stashing. (line 111) * Z g: Worktree. (line 26) * z i: Stashing. (line 20) * z I: Stashing. (line 42) -* z k: Stashing. (line 100) +* z k: Stashing. (line 94) * Z k: Worktree. (line 22) -* z l: Stashing. (line 123) +* z l: Stashing. (line 117) * Z m: Worktree. (line 19) -* z p: Stashing. (line 78) -* z v: Stashing. (line 104) +* z p: Stashing. (line 72) +* z v: Stashing. (line 98) * z w: Stashing. (line 24) * z W: Stashing. (line 46) * z x: Stashing. (line 30) @@ -9733,45 +9931,45 @@ Appendix D Function and Command Index [index] * Menu: -* bug-reference-mode: Committing. (line 326) -* forward-line: Rebasing. (line 145) -* git-commit-ack: Committing. (line 260) -* git-commit-cc: Committing. (line 272) -* git-commit-check-style-conventions: Committing. (line 378) -* git-commit-insert-pseudo-header: Committing. (line 257) -* git-commit-next-message: Committing. (line 171) -* git-commit-prev-message: Committing. (line 166) -* git-commit-propertize-diff: Committing. (line 318) -* git-commit-reported: Committing. (line 275) -* git-commit-review: Committing. (line 263) -* git-commit-save-message: Committing. (line 163) -* git-commit-save-message <1>: Committing. (line 304) -* git-commit-setup-changelog-support: Committing. (line 307) -* git-commit-signoff: Committing. (line 266) -* git-commit-suggested: Committing. (line 279) -* git-commit-test: Committing. (line 269) -* git-commit-turn-on-auto-fill: Committing. (line 311) -* git-commit-turn-on-flyspell: Committing. (line 314) -* git-rebase-backward-line: Rebasing. (line 142) -* git-rebase-break: Rebasing. (line 181) -* git-rebase-edit: Rebasing. (line 157) -* git-rebase-exec: Rebasing. (line 173) -* git-rebase-fixup: Rebasing. (line 163) -* git-rebase-insert: Rebasing. (line 185) -* git-rebase-kill-line: Rebasing. (line 167) -* git-rebase-label: Rebasing. (line 205) -* git-rebase-merge: Rebasing. (line 213) -* git-rebase-merge-toggle-editmsg: Rebasing. (line 219) -* git-rebase-move-line-down: Rebasing. (line 151) -* git-rebase-move-line-up: Rebasing. (line 148) -* git-rebase-pick: Rebasing. (line 170) -* git-rebase-reset: Rebasing. (line 208) -* git-rebase-reword: Rebasing. (line 154) -* git-rebase-show-commit: Rebasing. (line 126) -* git-rebase-show-or-scroll-down: Rebasing. (line 136) -* git-rebase-show-or-scroll-up: Rebasing. (line 130) -* git-rebase-squash: Rebasing. (line 160) -* git-rebase-undo: Rebasing. (line 188) +* bug-reference-mode: Committing. (line 481) +* forward-line: Rebasing. (line 150) +* git-commit-ack: Committing. (line 415) +* git-commit-cc: Committing. (line 427) +* git-commit-check-style-conventions: Committing. (line 533) +* git-commit-insert-pseudo-header: Committing. (line 412) +* git-commit-next-message: Committing. (line 326) +* git-commit-prev-message: Committing. (line 321) +* git-commit-propertize-diff: Committing. (line 473) +* git-commit-reported: Committing. (line 430) +* git-commit-review: Committing. (line 418) +* git-commit-save-message: Committing. (line 318) +* git-commit-save-message <1>: Committing. (line 459) +* git-commit-setup-changelog-support: Committing. (line 462) +* git-commit-signoff: Committing. (line 421) +* git-commit-suggested: Committing. (line 434) +* git-commit-test: Committing. (line 424) +* git-commit-turn-on-auto-fill: Committing. (line 466) +* git-commit-turn-on-flyspell: Committing. (line 469) +* git-rebase-backward-line: Rebasing. (line 147) +* git-rebase-break: Rebasing. (line 187) +* git-rebase-edit: Rebasing. (line 162) +* git-rebase-exec: Rebasing. (line 179) +* git-rebase-fixup: Rebasing. (line 168) +* git-rebase-insert: Rebasing. (line 191) +* git-rebase-kill-line: Rebasing. (line 172) +* git-rebase-label: Rebasing. (line 211) +* git-rebase-merge: Rebasing. (line 219) +* git-rebase-merge-toggle-editmsg: Rebasing. (line 225) +* git-rebase-move-line-down: Rebasing. (line 156) +* git-rebase-move-line-up: Rebasing. (line 153) +* git-rebase-pick: Rebasing. (line 176) +* git-rebase-reset: Rebasing. (line 214) +* git-rebase-reword: Rebasing. (line 159) +* git-rebase-show-commit: Rebasing. (line 131) +* git-rebase-show-or-scroll-down: Rebasing. (line 141) +* git-rebase-show-or-scroll-up: Rebasing. (line 135) +* git-rebase-squash: Rebasing. (line 165) +* git-rebase-undo: Rebasing. (line 194) * ido-enter-magit-status: Status Buffer. (line 96) * magit-add-section-hook: Sections. (line 291) * magit-after-save-refresh-status: Modes and Buffers. (line 294) @@ -9877,20 +10075,22 @@ Appendix D Function and Command Index * magit-clone-shallow-exclude: Cloning Repository. (line 61) * magit-clone-shallow-since: Cloning Repository. (line 55) * magit-clone-sparse: Cloning Repository. (line 38) -* magit-commit: Committing. (line 19) +* magit-commit: Committing. (line 21) * magit-commit <1>: Commands for Buffers Visiting Files. (line 52) * magit-commit <2>: Commands for Buffers Visiting Files. (line 176) -* magit-commit-amend: Committing. (line 28) -* magit-commit-augment: Committing. (line 69) -* magit-commit-create: Committing. (line 24) -* magit-commit-extend: Committing. (line 31) -* magit-commit-fixup: Committing. (line 49) -* magit-commit-instant-fixup: Committing. (line 56) -* magit-commit-instant-squash: Committing. (line 66) -* magit-commit-reword: Committing. (line 40) -* magit-commit-squash: Committing. (line 59) +* magit-commit-alter: Committing. (line 141) +* magit-commit-amend: Committing. (line 59) +* magit-commit-augment: Committing. (line 153) +* magit-commit-create: Committing. (line 29) +* magit-commit-extend: Committing. (line 45) +* magit-commit-fixup: Committing. (line 119) +* magit-commit-instant-fixup: Committing. (line 192) +* magit-commit-instant-squash: Committing. (line 204) +* magit-commit-revise: Committing. (line 167) +* magit-commit-reword: Committing. (line 65) +* magit-commit-squash: Committing. (line 130) * magit-completing-read: Completion Confirmation and the Selection. (line 374) * magit-copy-buffer-revision: Common Commands. (line 39) @@ -9939,17 +10139,17 @@ Appendix D Function and Command Index * magit-diff-visit-file: Visiting Files and Blobs. (line 40) * magit-diff-visit-file-other-frame: Visiting Files and Blobs. - (line 102) + (line 99) * magit-diff-visit-file-other-window: Visiting Files and Blobs. - (line 101) + (line 98) * magit-diff-visit-file-worktree: Visiting Files and Blobs. - (line 81) + (line 78) * magit-diff-visit-worktree-file-other-frame: Visiting Files and Blobs. - (line 104) + (line 101) * magit-diff-visit-worktree-file-other-window: Visiting Files and Blobs. - (line 103) + (line 100) * magit-diff-while-committing: Diffing. (line 164) -* magit-diff-while-committing <1>: Committing. (line 184) +* magit-diff-while-committing <1>: Committing. (line 339) * magit-diff-working-tree: Diffing. (line 62) * magit-disable-section-inserter: Per-Repository Configuration. (line 31) @@ -10052,51 +10252,51 @@ Appendix D Function and Command Index * magit-ido-completing-read: Completion Confirmation and the Selection. (line 363) * magit-init: Creating Repository. (line 7) -* magit-insert-am-sequence: Status Buffer. (line 137) -* magit-insert-assumed-unchanged-files: Status Buffer. (line 213) -* magit-insert-bisect-log: Status Buffer. (line 151) -* magit-insert-bisect-output: Status Buffer. (line 145) -* magit-insert-bisect-rest: Status Buffer. (line 148) -* magit-insert-diff-filter-header: Status Buffer. (line 282) -* magit-insert-error-header: Status Buffer. (line 273) -* magit-insert-head-branch-header: Status Buffer. (line 285) +* magit-insert-am-sequence: Status Buffer. (line 142) +* magit-insert-assumed-unchanged-files: Status Buffer. (line 249) +* magit-insert-bisect-log: Status Buffer. (line 156) +* magit-insert-bisect-output: Status Buffer. (line 150) +* magit-insert-bisect-rest: Status Buffer. (line 153) +* magit-insert-diff-filter-header: Status Buffer. (line 315) +* magit-insert-error-header: Status Buffer. (line 306) +* magit-insert-head-branch-header: Status Buffer. (line 318) * magit-insert-heading: Section Plumbing. (line 44) -* magit-insert-ignored-files: Status Buffer. (line 198) +* magit-insert-ignored-files: Status Buffer. (line 243) * magit-insert-local-branches: References Buffer. (line 244) -* magit-insert-merge-log: Status Buffer. (line 129) -* magit-insert-modules: Status Buffer. (line 324) -* magit-insert-modules-overview: Status Buffer. (line 342) +* magit-insert-merge-log: Status Buffer. (line 134) +* magit-insert-modules: Status Buffer. (line 357) +* magit-insert-modules-overview: Status Buffer. (line 375) * magit-insert-modules-unpulled-from-pushremote: Status Buffer. - (line 357) -* magit-insert-modules-unpulled-from-upstream: Status Buffer. (line 352) -* magit-insert-modules-unpushed-to-pushremote: Status Buffer. (line 367) -* magit-insert-modules-unpushed-to-upstream: Status Buffer. (line 362) -* magit-insert-push-branch-header: Status Buffer. (line 292) -* magit-insert-rebase-sequence: Status Buffer. (line 133) -* magit-insert-recent-commits: Status Buffer. (line 225) + (line 390) +* magit-insert-modules-unpulled-from-upstream: Status Buffer. (line 385) +* magit-insert-modules-unpushed-to-pushremote: Status Buffer. (line 400) +* magit-insert-modules-unpushed-to-upstream: Status Buffer. (line 395) +* magit-insert-push-branch-header: Status Buffer. (line 325) +* magit-insert-rebase-sequence: Status Buffer. (line 138) +* magit-insert-recent-commits: Status Buffer. (line 261) * magit-insert-remote-branches: References Buffer. (line 247) -* magit-insert-remote-header: Status Buffer. (line 305) -* magit-insert-repo-header: Status Buffer. (line 302) +* magit-insert-remote-header: Status Buffer. (line 338) +* magit-insert-repo-header: Status Buffer. (line 335) * magit-insert-section: Section Plumbing. (line 9) -* magit-insert-sequencer-sequence: Status Buffer. (line 141) -* magit-insert-skip-worktree-files: Status Buffer. (line 207) -* magit-insert-staged-changes: Status Buffer. (line 168) -* magit-insert-stashes: Status Buffer. (line 171) -* magit-insert-status-headers: Status Buffer. (line 259) +* magit-insert-sequencer-sequence: Status Buffer. (line 146) +* magit-insert-skip-worktree-files: Status Buffer. (line 246) +* magit-insert-staged-changes: Status Buffer. (line 162) +* magit-insert-stashes: Status Buffer. (line 165) +* magit-insert-status-headers: Status Buffer. (line 292) * magit-insert-tags: References Buffer. (line 250) -* magit-insert-tags-header: Status Buffer. (line 296) -* magit-insert-tracked-files: Status Buffer. (line 195) -* magit-insert-unpulled-cherries: Status Buffer. (line 234) -* magit-insert-unpulled-from-pushremote: Status Buffer. (line 181) -* magit-insert-unpulled-from-upstream: Status Buffer. (line 177) -* magit-insert-unpulled-or-recent-commits: Status Buffer. (line 219) -* magit-insert-unpushed-cherries: Status Buffer. (line 240) -* magit-insert-unpushed-to-pushremote: Status Buffer. (line 189) -* magit-insert-unpushed-to-upstream: Status Buffer. (line 185) -* magit-insert-unstaged-changes: Status Buffer. (line 165) -* magit-insert-untracked-files: Status Buffer. (line 154) -* magit-insert-upstream-branch-header: Status Buffer. (line 288) -* magit-insert-user-header: Status Buffer. (line 312) +* magit-insert-tags-header: Status Buffer. (line 329) +* magit-insert-tracked-files: Status Buffer. (line 240) +* magit-insert-unpulled-cherries: Status Buffer. (line 270) +* magit-insert-unpulled-from-pushremote: Status Buffer. (line 175) +* magit-insert-unpulled-from-upstream: Status Buffer. (line 171) +* magit-insert-unpulled-or-recent-commits: Status Buffer. (line 255) +* magit-insert-unpushed-cherries: Status Buffer. (line 276) +* magit-insert-unpushed-to-pushremote: Status Buffer. (line 183) +* magit-insert-unpushed-to-upstream: Status Buffer. (line 179) +* magit-insert-unstaged-changes: Status Buffer. (line 159) +* magit-insert-untracked-files: Status Buffer. (line 193) +* magit-insert-upstream-branch-header: Status Buffer. (line 321) +* magit-insert-user-header: Status Buffer. (line 345) * magit-jump-to-diffstat-or-diff: Diffing. (line 218) * magit-kill-this-buffer: Minor Mode for Buffers Visiting Blobs. (line 19) @@ -10149,8 +10349,8 @@ Appendix D Function and Command Index * magit-merge <1>: Merging. (line 86) * magit-merge-abort: Merging. (line 91) * magit-merge-absorb: Merging. (line 42) +* magit-merge-dissolve: Merging. (line 54) * magit-merge-editmsg: Merging. (line 30) -* magit-merge-into: Merging. (line 54) * magit-merge-nocommit: Merging. (line 36) * magit-merge-plain: Merging. (line 18) * magit-merge-preview: Merging. (line 75) @@ -10171,7 +10371,7 @@ Appendix D Function and Command Index * magit-patch-apply <1>: Maildir Patches. (line 23) * magit-patch-create: Plain Patches. (line 12) * magit-patch-save: Plain Patches. (line 26) -* magit-pop-revision-stack: Committing. (line 192) +* magit-pop-revision-stack: Committing. (line 347) * magit-process: Running Git. (line 20) * magit-process-file: Calling Git. (line 84) * magit-process-git: Calling Git. (line 77) @@ -10193,18 +10393,18 @@ Appendix D Function and Command Index * magit-push-tags: Pushing. (line 52) * magit-push-to-remote: Pushing. (line 91) * magit-rebase: Rebasing. (line 10) -* magit-rebase-abort: Rebasing. (line 111) +* magit-rebase-abort: Rebasing. (line 116) * magit-rebase-autosquash: Rebasing. (line 79) * magit-rebase-branch: Rebasing. (line 42) -* magit-rebase-continue: Rebasing. (line 97) -* magit-rebase-edit: Rebasing. (line 107) -* magit-rebase-edit-commit: Rebasing. (line 83) +* magit-rebase-continue: Rebasing. (line 102) +* magit-rebase-edit: Rebasing. (line 112) +* magit-rebase-edit-commit: Rebasing. (line 88) * magit-rebase-interactive: Rebasing. (line 76) * magit-rebase-onto-pushremote: Rebasing. (line 28) * magit-rebase-onto-upstream: Rebasing. (line 35) -* magit-rebase-remove-commit: Rebasing. (line 91) -* magit-rebase-reword-commit: Rebasing. (line 87) -* magit-rebase-skip: Rebasing. (line 103) +* magit-rebase-remove-commit: Rebasing. (line 96) +* magit-rebase-reword-commit: Rebasing. (line 92) +* magit-rebase-skip: Rebasing. (line 108) * magit-rebase-subset: Rebasing. (line 47) * magit-reflog-current: Logging. (line 336) * magit-reflog-head: Logging. (line 342) @@ -10341,17 +10541,17 @@ Appendix D Function and Command Index * magit-stash: Stashing. (line 9) * magit-stash-apply: Stashing. (line 52) * magit-stash-both: Stashing. (line 14) -* magit-stash-branch: Stashing. (line 107) -* magit-stash-branch-here: Stashing. (line 112) -* magit-stash-clear: Stashing. (line 120) -* magit-stash-drop: Stashing. (line 100) -* magit-stash-format-patch: Stashing. (line 117) +* magit-stash-branch: Stashing. (line 101) +* magit-stash-branch-here: Stashing. (line 106) +* magit-stash-clear: Stashing. (line 114) +* magit-stash-drop: Stashing. (line 94) +* magit-stash-format-patch: Stashing. (line 111) * magit-stash-index: Stashing. (line 20) * magit-stash-keep-index: Stashing. (line 30) -* magit-stash-list: Stashing. (line 123) -* magit-stash-pop: Stashing. (line 78) +* magit-stash-list: Stashing. (line 117) +* magit-stash-pop: Stashing. (line 72) * magit-stash-show: Diffing. (line 86) -* magit-stash-show <1>: Stashing. (line 104) +* magit-stash-show <1>: Stashing. (line 98) * magit-stash-worktree: Stashing. (line 24) * magit-stashes-maybe-update-stash-buffer: Sections. (line 108) * magit-status: Status Buffer. (line 23) @@ -10426,12 +10626,12 @@ Appendix D Function and Command Index * magit-worktree-status: Worktree. (line 26) * scroll-down: Diffing. (line 231) * scroll-up: Diffing. (line 228) -* with-editor-cancel: Committing. (line 152) -* with-editor-cancel <1>: Rebasing. (line 122) +* with-editor-cancel: Committing. (line 307) +* with-editor-cancel <1>: Rebasing. (line 127) * with-editor-debug: Debugging Tools. (line 85) -* with-editor-finish: Committing. (line 148) -* with-editor-finish <1>: Rebasing. (line 118) -* with-editor-usage-message: Committing. (line 329) +* with-editor-finish: Committing. (line 303) +* with-editor-finish <1>: Rebasing. (line 123) +* with-editor-usage-message: Committing. (line 484)  File: magit.info, Node: Variable Index, Prev: Function and Command Index, Up: Top @@ -10456,16 +10656,16 @@ Appendix E Variable Index * branch.NAME.rebase: Branching. (line 343) * branch.NAME.remote: Branching. (line 338) * core.notesRef: Notes. (line 53) -* git-commit-finish-query-functions: Committing. (line 363) -* git-commit-known-pseudo-headers: Committing. (line 253) -* git-commit-major-mode: Committing. (line 290) -* git-commit-post-finish-hook: Committing. (line 332) -* git-commit-setup-hook: Committing. (line 299) -* git-commit-style-convention-checks: Committing. (line 383) -* git-commit-summary-max-length: Committing. (line 358) -* git-rebase-auto-advance: Rebasing. (line 191) -* git-rebase-confirm-cancel: Rebasing. (line 197) -* git-rebase-show-instructions: Rebasing. (line 194) +* git-commit-finish-query-functions: Committing. (line 518) +* git-commit-known-pseudo-headers: Committing. (line 408) +* git-commit-major-mode: Committing. (line 445) +* git-commit-post-finish-hook: Committing. (line 487) +* git-commit-setup-hook: Committing. (line 454) +* git-commit-style-convention-checks: Committing. (line 538) +* git-commit-summary-max-length: Committing. (line 513) +* git-rebase-auto-advance: Rebasing. (line 197) +* git-rebase-confirm-cancel: Rebasing. (line 203) +* git-rebase-show-instructions: Rebasing. (line 200) * global-auto-revert-mode: Modes and Buffers. (line 343) * magit-auto-revert-immediately: Modes and Buffers. (line 352) * magit-auto-revert-mode: Modes and Buffers. (line 339) @@ -10490,12 +10690,12 @@ Appendix E Variable Index * magit-clone-set-remote-head: Cloning Repository. (line 66) * magit-clone-set-remote.pushDefault: Cloning Repository. (line 75) * magit-clone-url-format: Cloning Repository. (line 114) -* magit-commit-ask-to-stage: Committing. (line 75) -* magit-commit-diff-inhibit-same-window: Committing. (line 107) -* magit-commit-extend-override-date: Committing. (line 82) -* magit-commit-reword-override-date: Committing. (line 85) -* magit-commit-show-diff: Committing. (line 79) -* magit-commit-squash-confirm: Committing. (line 88) +* magit-commit-ask-to-stage: Committing. (line 225) +* magit-commit-diff-inhibit-same-window: Committing. (line 240) +* magit-commit-extend-override-date: Committing. (line 280) +* magit-commit-reword-override-date: Committing. (line 284) +* magit-commit-show-diff: Committing. (line 221) +* magit-commit-squash-confirm: Committing. (line 269) * magit-completing-read-function: Completion Confirmation and the Selection. (line 344) * magit-define-global-key-bindings: Essential Settings. (line 239) @@ -10513,7 +10713,7 @@ Appendix E Variable Index * magit-diff-refine-ignore-whitespace: Diffing. (line 243) * magit-diff-unmarked-lines-keep-foreground: Diffing. (line 335) * magit-diff-visit-previous-blob: Visiting Files and Blobs. - (line 69) + (line 66) * magit-direct-use-buffer-arguments: Transient Arguments and Buffer Variables. (line 73) * magit-display-buffer-function: Modes and Buffers. (line 57) @@ -10524,6 +10724,7 @@ Appendix E Variable Index * magit-ediff-dwim-show-on-hunks: Ediffing. (line 111) * magit-ediff-quit-hook: Ediffing. (line 124) * magit-ediff-show-stash-with-index: Ediffing. (line 118) +* magit-format-file-function: Diffing. (line 352) * magit-generate-buffer-name-function: Modes and Buffers. (line 131) * magit-git-debug: Calling Git. (line 95) * magit-git-executable: Running Git. (line 159) @@ -10537,19 +10738,19 @@ Appendix E Variable Index (line 124) * magit-log-margin: Logging. (line 223) * magit-log-margin-show-committer-date: Logging. (line 255) -* magit-log-section-commit-count: Status Buffer. (line 229) +* magit-log-section-commit-count: Status Buffer. (line 265) * magit-log-select-margin: Logging. (line 304) * magit-log-show-color-graph-limit: Logging. (line 174) * magit-log-show-refname-after-summary: Logging. (line 170) * magit-log-show-signatures-limit: Logging. (line 180) * magit-log-trace-definition-function: Diffing. (line 192) -* magit-module-sections-hook: Status Buffer. (line 331) -* magit-module-sections-nested: Status Buffer. (line 334) +* magit-module-sections-hook: Status Buffer. (line 364) +* magit-module-sections-nested: Status Buffer. (line 367) * magit-no-confirm: Completion Confirmation and the Selection. (line 21) -* magit-pop-revision-stack-format: Committing. (line 219) +* magit-pop-revision-stack-format: Committing. (line 374) * magit-post-clone-hook: Cloning Repository. (line 133) -* magit-post-commit-hook: Committing. (line 96) +* magit-post-commit-hook: Committing. (line 229) * magit-post-display-buffer-hook: Modes and Buffers. (line 117) * magit-pre-display-buffer-hook: Modes and Buffers. (line 108) * magit-prefer-remote-upstream: Branching. (line 431) @@ -10576,10 +10777,10 @@ Appendix E Variable Index * magit-remote-git-executable: Running Git. (line 165) * magit-repolist-columns: Repository List. (line 12) * magit-repository-directories: Status Buffer. (line 57) -* magit-revision-filter-files-on-follow: Diffing. (line 404) -* magit-revision-insert-related-refs: Diffing. (line 355) -* magit-revision-show-gravatars: Diffing. (line 364) -* magit-revision-use-hash-sections: Diffing. (line 380) +* magit-revision-filter-files-on-follow: Diffing. (line 412) +* magit-revision-insert-related-refs: Diffing. (line 363) +* magit-revision-show-gravatars: Diffing. (line 372) +* magit-revision-use-hash-sections: Diffing. (line 388) * magit-root-section: Section Plumbing. (line 197) * magit-save-repository-buffers: Modes and Buffers. (line 314) * magit-section-cache-visibility: Sections. (line 219) @@ -10589,10 +10790,12 @@ Appendix E Variable Index * magit-section-show-child-count: Sections. (line 356) * magit-section-visibility-indicator: Sections. (line 246) * magit-shell-command-verbose-prompt: Running Git. (line 112) -* magit-stashes-margin: Stashing. (line 125) -* magit-status-headers-hook: Status Buffer. (line 264) -* magit-status-margin: Status Buffer. (line 375) +* magit-stashes-margin: Stashing. (line 119) +* magit-status-file-list-limit: Status Buffer. (line 230) +* magit-status-headers-hook: Status Buffer. (line 297) +* magit-status-margin: Status Buffer. (line 408) * magit-status-sections-hook: Status Buffer. (line 122) +* magit-status-show-untracked-files: Status Buffer. (line 197) * magit-submodule-list-columns: Submodules. (line 25) * magit-this-process: Calling Git. (line 228) * magit-uniquify-buffer-names: Modes and Buffers. (line 190) @@ -10629,169 +10832,179 @@ Node: Introduction3572 Node: Installation8288 Node: Installing from Melpa8618 Node: Installing from the Git Repository9693 -Node: Post-Installation Tasks12507 -Node: Getting Started13790 -Node: Interface Concepts19601 -Node: Modes and Buffers19980 -Ref: Switching Buffers21482 -Ref: Naming Buffers26128 -Ref: Quitting Windows29085 -Ref: Automatic Refreshing of Magit Buffers30882 -Ref: Automatic Saving of File-Visiting Buffers33598 -Ref: Automatic Reverting of File-Visiting Buffers34589 -Ref: Risk of Reverting Automatically39381 -Node: Sections41652 -Ref: Section Movement42457 -Ref: Section Visibility47244 -Ref: Section Hooks53822 -Ref: Section Types and Values56111 -Ref: Section Options57412 -Node: Transient Commands57791 -Node: Transient Arguments and Buffer Variables59267 -Node: Completion Confirmation and the Selection66284 -Ref: Action Confirmation66545 -Ref: Completion and Confirmation74918 -Ref: The Selection77949 -Ref: The hunk-internal region80688 -Ref: Support for Completion Frameworks81612 -Ref: Additional Completion Options86316 -Node: Mouse Support86766 -Node: Running Git87342 -Ref: Viewing Git Output87462 -Ref: Git Process Status89353 -Ref: Running Git Manually90197 -Ref: Git Executable92770 -Ref: Global Git Arguments95659 -Node: Inspecting96374 -Node: Status Buffer97531 -Ref: Status Sections102439 -Ref: Status Header Sections108018 -Ref: Status Module Sections110511 -Ref: Status Options112883 -Node: Repository List114152 -Node: Logging118930 -Ref: Refreshing Logs121665 -Ref: Log Buffer123009 -Ref: Log Margin127736 -Ref: Select from Log130793 -Ref: Reflog132911 -Ref: Cherries134458 -Node: Diffing136230 -Ref: Refreshing Diffs140181 -Ref: Commands Available in Diffs143775 -Ref: Diff Options146172 -Ref: Revision Buffer151520 -Node: Ediffing154761 -Node: References Buffer160811 -Ref: References Sections171371 -Node: Bisecting172156 -Node: Visiting Files and Blobs174467 -Ref: General-Purpose Visit Commands174909 -Ref: Visiting Files and Blobs from a Diff175727 -Node: Blaming179036 -Node: Manipulating186024 -Node: Creating Repository186366 -Node: Cloning Repository186903 -Node: Staging and Unstaging193344 -Ref: Staging from File-Visiting Buffers197268 -Node: Applying198283 -Node: Committing200356 -Ref: Initiating a Commit200877 -Ref: Editing Commit Messages205970 -Ref: Using the Revision Stack208524 -Ref: Commit Pseudo Headers211456 -Ref: Commit Mode and Hooks212608 -Ref: Commit Message Conventions215321 -Node: Branching217193 -Ref: The Two Remotes217314 -Ref: Branch Commands219883 -Ref: Branch Git Variables232620 -Ref: Auxiliary Branch Commands237867 -Node: Merging238884 -Node: Resolving Conflicts243040 -Node: Rebasing248414 -Ref: Editing Rebase Sequences253123 -Ref: Information About In-Progress Rebase257226 -Ref: Rebasing-Footnote-1266226 -Node: Cherry Picking266822 -Ref: Reverting271132 -Node: Resetting272492 -Node: Stashing274318 -Node: Transferring280861 -Node: Remotes281083 -Ref: Remote Commands281180 -Ref: Remote Git Variables285132 -Node: Fetching286316 -Node: Pulling288799 -Node: Pushing289825 -Node: Plain Patches294116 -Node: Maildir Patches295587 -Node: Miscellaneous297066 -Node: Tagging297412 -Node: Notes299305 -Node: Submodules301640 -Ref: Listing Submodules301801 -Ref: Submodule Transient303857 -Node: Subtree306210 -Node: Worktree308141 -Node: Sparse checkouts309217 -Node: Bundle311993 -Node: Common Commands312368 -Node: Wip Modes314996 -Ref: Wip Graph319842 -Ref: Legacy Wip Modes322076 -Node: Commands for Buffers Visiting Files324884 -Node: Minor Mode for Buffers Visiting Blobs333111 -Node: Customizing333909 -Node: Per-Repository Configuration335505 -Node: Essential Settings337759 -Ref: Safety338048 -Ref: Performance339729 -Ref: Log Performance342522 -Ref: Diff Performance343827 -Ref: Refs Buffer Performance345168 -Ref: Committing Performance345743 -Ref: Microsoft Windows Performance346725 -Ref: MacOS Performance347814 -Ref: Global Bindings348699 -Ref: Essential Settings-Footnote-1350874 -Node: Plumbing350956 -Node: Calling Git351785 -Ref: Getting a Value from Git353244 -Ref: Calling Git for Effect356870 -Node: Section Plumbing362662 -Ref: Creating Sections362814 -Ref: Section Selection366615 -Ref: Matching Sections368290 -Node: Refreshing Buffers374116 -Node: Conventions377260 -Ref: Theming Faces377424 -Node: FAQ385469 -Node: FAQ - How to ...?385907 -Ref: How to pronounce Magit?386040 -Ref: How to show git's output?386734 -Ref: How to install the gitman info manual?387359 -Ref: How to show diffs for gpg-encrypted files?388170 -Ref: How does branching and pushing work?388579 -Ref: Should I disable VC?388743 -Node: FAQ - Issues and Errors389228 -Ref: Magit is slow389373 -Ref: I changed several thousand files at once and now Magit is unusable389519 -Ref: I am having problems committing390058 -Ref: I am using MS Windows and cannot push with Magit390323 -Ref: I am using macOS and SOMETHING works in shell but not in Magit390723 -Ref: Expanding a file to show the diff causes it to disappear391314 -Ref: Point is wrong in the COMMIT_EDITMSG buffer391664 -Ref: The mode-line information isn't always up-to-date392488 -Ref: A branch and tag sharing the same name breaks SOMETHING393327 -Ref: My Git hooks work on the command-line but not inside Magit393975 -Ref: git-commit-mode isn't used when committing from the command-line394567 -Ref: Point ends up inside invisible text when jumping to a file-visiting buffer396565 -Ref: I am no longer able to save popup defaults397157 -Node: Debugging Tools397954 -Node: Keystroke Index401893 -Node: Function and Command Index439697 -Node: Variable Index491061 +Node: Post-Installation Tasks12745 +Node: Getting Started14028 +Node: Interface Concepts19839 +Node: Modes and Buffers20218 +Ref: Switching Buffers21720 +Ref: Naming Buffers26366 +Ref: Quitting Windows29323 +Ref: Automatic Refreshing of Magit Buffers31120 +Ref: Automatic Saving of File-Visiting Buffers33836 +Ref: Automatic Reverting of File-Visiting Buffers34827 +Ref: Risk of Reverting Automatically39619 +Node: Sections41890 +Ref: Section Movement42695 +Ref: Section Visibility47482 +Ref: Section Hooks54060 +Ref: Section Types and Values56349 +Ref: Section Options57650 +Node: Transient Commands58029 +Node: Transient Arguments and Buffer Variables59505 +Node: Completion Confirmation and the Selection66522 +Ref: Action Confirmation66783 +Ref: Completion and Confirmation75156 +Ref: The Selection78187 +Ref: The hunk-internal region80926 +Ref: Support for Completion Frameworks81850 +Ref: Additional Completion Options86554 +Node: Mouse Support87004 +Node: Running Git87580 +Ref: Viewing Git Output87700 +Ref: Git Process Status89591 +Ref: Running Git Manually90435 +Ref: Git Executable93008 +Ref: Global Git Arguments95897 +Node: Inspecting96612 +Node: Status Buffer97769 +Ref: Status Sections102677 +Ref: Status File List Sections105404 +Ref: Status Log Sections107981 +Ref: Status Header Sections109331 +Ref: Status Module Sections111824 +Ref: Status Options114196 +Node: Repository List115465 +Node: Logging120243 +Ref: Refreshing Logs122978 +Ref: Log Buffer124322 +Ref: Log Margin129049 +Ref: Select from Log132106 +Ref: Reflog134224 +Ref: Cherries135771 +Node: Diffing137543 +Ref: Refreshing Diffs141494 +Ref: Commands Available in Diffs145088 +Ref: Diff Options147485 +Ref: Revision Buffer153283 +Node: Ediffing156524 +Node: References Buffer162574 +Ref: References Sections173134 +Node: Bisecting173919 +Node: Visiting Files and Blobs176230 +Ref: General-Purpose Visit Commands176672 +Ref: Visiting Files and Blobs from a Diff177490 +Node: Blaming180722 +Node: Manipulating187710 +Node: Creating Repository188052 +Node: Cloning Repository188589 +Node: Staging and Unstaging195030 +Ref: Staging from File-Visiting Buffers198954 +Node: Applying199969 +Node: Committing202042 +Ref: Initiating a Commit202669 +Ref: Creating a new commit202981 +Ref: Editing the last commit203091 +Ref: Editing any reachable commit205070 +Ref: Editing any reachable commit and rebasing immediately209483 +Ref: Options used by commit commands211131 +Ref: Used by all or most commit commands211203 +Ref: Used by all squash and fixup commands213434 +Ref: Used by specific commit commands213982 +Ref: Editing Commit Messages214306 +Ref: Using the Revision Stack216860 +Ref: Commit Pseudo Headers219792 +Ref: Commit Mode and Hooks220944 +Ref: Commit Message Conventions223657 +Node: Branching225529 +Ref: The Two Remotes225650 +Ref: Branch Commands228219 +Ref: Branch Git Variables240956 +Ref: Auxiliary Branch Commands246203 +Node: Merging247220 +Node: Resolving Conflicts251380 +Node: Rebasing256754 +Ref: Editing Rebase Sequences261714 +Ref: Information About In-Progress Rebase265875 +Ref: Rebasing-Footnote-1274875 +Node: Cherry Picking275471 +Ref: Reverting279781 +Node: Resetting281141 +Node: Stashing282967 +Node: Transferring289208 +Node: Remotes289430 +Ref: Remote Commands289527 +Ref: Remote Git Variables293479 +Node: Fetching294663 +Node: Pulling297146 +Node: Pushing298172 +Node: Plain Patches302463 +Node: Maildir Patches303934 +Node: Miscellaneous305413 +Node: Tagging305759 +Node: Notes307652 +Node: Submodules309987 +Ref: Listing Submodules310148 +Ref: Submodule Transient312204 +Node: Subtree314557 +Node: Worktree316488 +Node: Sparse checkouts317564 +Node: Bundle320340 +Node: Common Commands320715 +Node: Wip Modes323343 +Ref: Wip Graph328189 +Ref: Legacy Wip Modes330423 +Node: Commands for Buffers Visiting Files333231 +Node: Minor Mode for Buffers Visiting Blobs341458 +Node: Customizing342256 +Node: Per-Repository Configuration343852 +Node: Essential Settings346106 +Ref: Safety346395 +Ref: Performance348076 +Ref: Log Performance350869 +Ref: Diff Performance352174 +Ref: Refs Buffer Performance353515 +Ref: Committing Performance354090 +Ref: Microsoft Windows Performance355072 +Ref: MacOS Performance356161 +Ref: Global Bindings357046 +Ref: Essential Settings-Footnote-1359221 +Node: Plumbing359303 +Node: Calling Git360132 +Ref: Getting a Value from Git361591 +Ref: Calling Git for Effect365217 +Node: Section Plumbing371009 +Ref: Creating Sections371161 +Ref: Section Selection374962 +Ref: Matching Sections376637 +Node: Refreshing Buffers382463 +Node: Conventions385607 +Ref: Theming Faces385771 +Node: FAQ393816 +Node: FAQ - How to ...?394254 +Ref: How to pronounce Magit?394387 +Ref: How to show git's output?395081 +Ref: How to install the gitman info manual?395706 +Ref: How to show diffs for gpg-encrypted files?396517 +Ref: How does branching and pushing work?396926 +Ref: Should I disable VC?397090 +Node: FAQ - Issues and Errors397575 +Ref: Magit is slow397720 +Ref: I changed several thousand files at once and now Magit is unusable397866 +Ref: I am having problems committing398405 +Ref: I am using MS Windows and cannot push with Magit398670 +Ref: I am using macOS and SOMETHING works in shell but not in Magit399070 +Ref: Expanding a file to show the diff causes it to disappear399661 +Ref: Point is wrong in the COMMIT_EDITMSG buffer400011 +Ref: The mode-line information isn't always up-to-date400835 +Ref: A branch and tag sharing the same name breaks SOMETHING401674 +Ref: My Git hooks work on the command-line but not inside Magit402322 +Ref: git-commit-mode isn't used when committing from the command-line402914 +Ref: Point ends up inside invisible text when jumping to a file-visiting buffer404912 +Ref: I am no longer able to save popup defaults405504 +Node: Debugging Tools406301 +Node: Keystroke Index410240 +Node: Function and Command Index448190 +Node: Variable Index499700  End Tag Table diff --git a/elpa/magit-section-20250107.641/dir b/elpa/magit-section-20250518.653/dir similarity index 100% rename from elpa/magit-section-20250107.641/dir rename to elpa/magit-section-20250518.653/dir diff --git a/elpa/magit-section-20250107.641/magit-section-autoloads.el b/elpa/magit-section-20250518.653/magit-section-autoloads.el similarity index 100% rename from elpa/magit-section-20250107.641/magit-section-autoloads.el rename to elpa/magit-section-20250518.653/magit-section-autoloads.el diff --git a/elpa/magit-section-20250107.641/magit-section-pkg.el b/elpa/magit-section-20250518.653/magit-section-pkg.el similarity index 66% rename from elpa/magit-section-20250107.641/magit-section-pkg.el rename to elpa/magit-section-20250518.653/magit-section-pkg.el index 241be969..4378ce88 100644 --- a/elpa/magit-section-20250107.641/magit-section-pkg.el +++ b/elpa/magit-section-20250518.653/magit-section-pkg.el @@ -1,13 +1,13 @@ ;; -*- no-byte-compile: t; lexical-binding: nil -*- -(define-package "magit-section" "20250107.641" +(define-package "magit-section" "20250518.653" "Sections for read-only buffers." '((emacs "27.1") - (compat "30.0.1.0") - (dash "2.19.1") + (compat "30.0.2.0") + (llama "0.6.1") (seq "2.24")) :url "https://github.com/magit/magit" - :commit "3ec4a182a602ac890844588ab39829912f0e168d" - :revdesc "3ec4a182a602" + :commit "c556fee1bd3ccc44da9f2322ec17dc5c3f0ef5be" + :revdesc "c556fee1bd3c" :keywords '("tools") :authors '(("Jonas Bernoulli" . "emacs.magit@jonas.bernoulli.dev")) :maintainers '(("Jonas Bernoulli" . "emacs.magit@jonas.bernoulli.dev"))) diff --git a/elpa/magit-section-20250107.641/magit-section.el b/elpa/magit-section-20250518.653/magit-section.el similarity index 85% rename from elpa/magit-section-20250107.641/magit-section.el rename to elpa/magit-section-20250518.653/magit-section.el index 014f020a..9cec925e 100644 --- a/elpa/magit-section-20250107.641/magit-section.el +++ b/elpa/magit-section-20250518.653/magit-section.el @@ -8,12 +8,12 @@ ;; Homepage: https://github.com/magit/magit ;; Keywords: tools -;; Package-Version: 20250107.641 -;; Package-Revision: 3ec4a182a602 +;; Package-Version: 20250518.653 +;; Package-Revision: c556fee1bd3c ;; Package-Requires: ( ;; (emacs "27.1") -;; (compat "30.0.1.0") -;; (dash "2.19.1") +;; (compat "30.0.2.0") +;; (llama "0.6.1") ;; (seq "2.24")) ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -45,8 +45,8 @@ (require 'cl-lib) (require 'compat) -(require 'dash) (require 'eieio) +(require 'llama) (require 'subr-x) ;; For older Emacs releases we depend on an updated `seq' release from GNU @@ -109,20 +109,6 @@ similar defect.") "Hook run by `magit-section-goto'. That function in turn is used by all section movement commands.") -(defvar magit-section-highlight-hook - (list #'magit-section-highlight - #'magit-section-highlight-selection) - "Functions used to highlight the current section. -Each function is run with the current section as only argument -until one of them returns non-nil.") - -(defvar magit-section-unhighlight-hook nil - "Functions used to unhighlight the previously current section. -Each function is run with the current section as only argument -until one of them returns non-nil. Most sections are properly -unhighlighted without requiring a specialized unhighlighter, -diff-related sections being the only exception.") - (defvar magit-section-set-visibility-hook (list #'magit-section-cached-visibility) "Hook used to set the initial visibility of a section. @@ -138,6 +124,21 @@ hardcoded section specific default (see `magit-insert-section').") :link '(info-link "(magit)Sections") :group 'extensions) +(defcustom magit-section-highlight-current t + "Whether to highlight the current section." + :package-version '(magit-section . "4.3.6") + :group 'magit-section + :type 'boolean) + +(defcustom magit-section-highlight-selection t + "Whether to highlight the selected sections. +If you disable this, you probably also want to disable +`magit-section-highlight-current' to get the region to +always look as it would be in non-magit buffers." + :package-version '(magit-section . "4.3.6") + :group 'magit-section + :type 'boolean) + (defcustom magit-section-show-child-count t "Whether to append the number of children to section headings. This only applies to sections for which doing so makes sense." @@ -241,6 +242,8 @@ Otherwise the value has to have one of these two forms: (defcustom magit-section-keep-region-overlay nil "Whether to keep the region overlay when there is a valid selection. +We strongly suggest that you keep the default value, nil. + By default Magit removes the regular region overlay if, and only if, that region constitutes a valid selection as understood by Magit commands. Otherwise it does not remove that overlay, and @@ -266,21 +269,10 @@ does *not* constitute a valid selection, then the region is circumstances that you want to use a non-magit command to act on the region. -Besides keeping the region overlay, setting this option to t also -causes all face properties, except for `:foreground', to be -ignored for the faces used to highlight headings of selected -sections. This avoids the worst conflicts that result from -displaying the region and the selection overlays at the same -time. We are not interested in dealing with other conflicts. -In fact we *already* provide a way to avoid all of these -conflicts: *not* changing the value of this option. - -It should be clear by now that we consider it a mistake to set -this to display the region when the Magit selection is also -visualized, but since it has been requested a few times and -because it doesn't cost much to offer this option we do so. -However that might change. If the existence of this option -starts complicating other things, then it will be removed." +Depending on the used theme, the `magit-*-highlight-selection' +faces might conflict with the `region' face. If that happens and +it bothers you, then you have to customize these faces to address +the conflicts." :package-version '(magit-section . "2.3.0") :group 'magit-section :type 'boolean) @@ -316,12 +308,17 @@ no effect. This also has no effect for Emacs >= 28, where (defvar-local magit-section-pre-command-section nil) (defvar-local magit-section-highlight-force-update nil) (defvar-local magit-section-highlight-overlays nil) -(defvar-local magit-section-highlighted-sections nil) -(defvar-local magit-section-unhighlight-sections nil) +(defvar-local magit-section-selection-overlays nil) +(defvar-local magit-section-highlighted-sections nil + "List of highlighted sections that may have to be repainted on focus change.") +(defvar-local magit-section-focused-sections nil) (defvar-local magit-section-inhibit-markers nil) (defvar-local magit-section-insert-in-reverse nil) +(defvar-local magit--refreshing-buffer-p nil + "Whether the current buffer is presently being refreshed.") + ;;; Faces (defgroup magit-section-faces nil @@ -385,9 +382,12 @@ no effect. This also has no effect for Emacs >= 28, where (content :initform nil) (end :initform nil) (hidden) + (painted) (washer :initform nil :initarg :washer) (inserter :initform (symbol-value 'magit--current-section-hook)) + (selective-highlight :initform nil :initarg :selective-highlight) (heading-highlight-face :initform nil :initarg :heading-highlight-face) + (heading-selection-face :initform nil :initarg :heading-selection-face) (parent :initform nil) (children :initform nil))) @@ -397,8 +397,7 @@ no effect. This also has no effect for Emacs >= 28, where (defvar-keymap magit-section-heading-map :doc "Keymap used in the heading line of all expandable sections. -This keymap is used in addition to the section-specific keymap, -if any." +This keymap is used in addition to the section-specific keymap, if any." "" #'ignore "" #'magit-mouse-toggle-section "" #'magit-mouse-toggle-section) @@ -553,24 +552,27 @@ The return value has the form ((TYPE . VALUE)...)." This is used to correlate different incarnations of the same section, see `magit-section-ident' and `magit-get-section'. -Sections whose values that are not constant and/or unique should -implement a method that return a value that can be used for this -purpose.") +Sections whose values are not constant and/or unique should +implement a method that return a value that can be used for +thispurpose.") (cl-defmethod magit-section-ident-value ((section magit-section)) "Return the value unless it is an object. -Different object incarnations representing the same value tend to not be -equal, so call this generic function on the object itself to determine a -constant value." +Different object incarnations representing the same value tend to +not be equal, so call this generic function on the object itself +to determine a constant value." (let ((value (oref section value))) (if (eieio-object-p value) (magit-section-ident-value value) value))) (cl-defmethod magit-section-ident-value ((object eieio-default-superclass)) - "Simply return the object itself. That likely isn't -good enough, so you need to implement your own method." + "For values that are objects, simply return the object itself. +Two objects that represent the same entity are not `equal'. So if +the values of the objects of a certain section class are themselves +objects, then a method has to be defined for objects of one of the +involved classes." object) (defun magit-get-section (ident &optional root) @@ -586,10 +588,8 @@ instead of in the one whose root `magit-root-section' is." (pcase-let ((`(,type . ,value) (car ident))) (setq section (cl-find-if - (lambda (section) - (and (eq (oref section type) type) - (equal (magit-section-ident-value section) - value))) + (##and (eq (oref % type) type) + (equal (magit-section-ident-value %) value)) (oref section children))))) (pop ident)) section))) @@ -634,11 +634,11 @@ with SECTION, otherwise return a list of section types." (when-let (((not (oref section hidden))) (children (oref section children))) (when (seq-some #'magit-section-content-p children) - (when (seq-some (lambda (c) (oref c hidden)) children) + (when (seq-some (##oref % hidden) children) (keymap-set-after menu "" `(menu-item "Expand children" magit-section-show-children))) - (when (seq-some (lambda (c) (not (oref c hidden))) children) + (when (seq-some (##not (oref % hidden)) children) (keymap-set-after menu "" `(menu-item "Collapse children" magit-section-hide-children))))) @@ -673,7 +673,7 @@ See `magit-menu-format-desc'." ,def ;; Without this, the keys for point would be shown instead ;; of the relevant ones from where the click occurred. - :keys ,(apply-partially #'magit--menu-position-keys def) + :keys ,(##magit--menu-position-keys def) ,@props)) (defun magit--menu-position-keys (def) @@ -868,6 +868,12 @@ If there is no previous sibling section, then move to the parent." (magit-section-backward)) (magit-section-goto -1)))) +(defun magit-mouse-set-point (event &optional promote-to-region) + "Like `mouse-set-point' but also call `magit-section-movement-hook'." + (interactive "e\np") + (mouse-set-point event promote-to-region) + (run-hook-with-args 'magit-section-movement-hook (magit-current-section))) + (defun magit-section-goto (arg) (if (integerp arg) (progn (forward-line arg) @@ -893,11 +899,11 @@ With a prefix argument also expand it." heading) ,@(and (not (plist-member properties :description)) (list :description heading)) ,@(and inserter - `(:if (lambda () (memq ',inserter - (bound-and-true-p magit-status-sections-hook))))) - :inapt-if-not (lambda () (magit-get-section - (cons (cons ',type ,value) - (magit-section-ident magit-root-section)))) + `(:if (##memq ',inserter + (bound-and-true-p magit-status-sections-hook)))) + :inapt-if-not (##magit-get-section + (cons (cons ',type ,value) + (magit-section-ident magit-root-section))) (interactive "P") (if-let ((section (magit-get-section (cons (cons ',type ,value) @@ -914,7 +920,8 @@ With a prefix argument also expand it." heading) "Show the body of the current section." (interactive (list (magit-current-section))) (oset section hidden nil) - (magit-section--maybe-wash section) + (magit-section--opportunistic-wash section) + (magit-section--opportunistic-paint section) (when-let ((beg (oref section content))) (remove-overlays beg (oref section end) 'invisible t)) (magit-section-maybe-update-visibility-indicator section) @@ -924,22 +931,6 @@ With a prefix argument also expand it." heading) (magit-section-hide child) (magit-section-show child)))) -(defun magit-section--maybe-wash (section) - (when-let ((washer (oref section washer))) - (oset section washer nil) - (let ((inhibit-read-only t) - (magit-insert-section--parent section) - (magit-insert-section--current section) - (content (oref section content))) - (save-excursion - (if (and content (< content (oref section end))) - (funcall washer section) ; already partially washed (hunk) - (goto-char (oref section end)) - (oset section content (point-marker)) - (funcall washer) - (oset section end (point-marker))))) - (setq magit-section-highlight-force-update t))) - (defun magit-section-hide (section) "Hide the body of the current section." (interactive (list (magit-current-section))) @@ -971,7 +962,7 @@ With a prefix argument also expand it." heading) "Toggle visibility of bodies of children of the current section." (interactive (list (magit-current-section))) (let* ((children (oref section children)) - (show (--any-p (oref it hidden) children))) + (show (seq-some (##oref % hidden) children))) (dolist (c children) (oset c hidden show))) (magit-section-show section)) @@ -1031,12 +1022,14 @@ global map, this involves advising `tab-bar--define-keys'." (eq (global-key-binding [C-tab]) 'tab-next) (fboundp 'tab-bar-switch-to-next-tab)) (tab-bar-switch-to-next-tab current-prefix-arg)) + ((eq section magit-root-section) + (magit-section-cycle-global)) ((oref section hidden) (magit-section-show section) (magit-section-hide-children section)) ((let ((children (oref section children))) - (cond ((and (--any-p (oref it hidden) children) - (--any-p (oref it children) children)) + (cond ((and (seq-some (##oref % hidden) children) + (seq-some (##oref % children) children)) (magit-section-show-headings section)) ((seq-some #'magit-section-hidden-body children) (magit-section-show-children section)) @@ -1046,17 +1039,24 @@ global map, this involves advising `tab-bar--define-keys'." "Cycle visibility of all sections in the current buffer." (interactive) (let ((children (oref magit-root-section children))) - (cond ((and (--any-p (oref it hidden) children) - (--any-p (oref it children) children)) + (cond ((and (seq-some (##oref % hidden) children) + (seq-some (##oref % children) children)) (magit-section-show-headings magit-root-section)) ((seq-some #'magit-section-hidden-body children) (magit-section-show-children magit-root-section)) (t (mapc #'magit-section-hide children))))) +(defun magit-section-hidden (section) + "Return t if SECTION and/or an ancestor is hidden." + (or (oref section hidden) + (and-let* ((parent (oref section parent))) + (magit-section-hidden parent)))) + (defun magit-section-hidden-body (section &optional pred) + "Return t if the content of SECTION or of any children is hidden." (if-let ((children (oref section children))) - (funcall (or pred #'-any-p) #'magit-section-hidden-body children) + (funcall (or pred #'seq-some) #'magit-section-hidden-body children) (and (oref section content) (oref section hidden)))) @@ -1075,8 +1075,10 @@ SECTION's body (and heading) obviously cannot be visible." (defun magit-section-show-level (level) "Show surrounding sections up to LEVEL. -If LEVEL is negative, show up to the absolute value. -Sections at higher levels are hidden." +Likewise hide sections at higher levels. If the region selects multiple +sibling sections, act on all marked trees. If LEVEL is negative, show +all sections up to the absolute value of that, not just surrounding +sections." (if (< level 0) (let ((s (magit-current-section))) (setq level (- level)) @@ -1084,13 +1086,15 @@ Sections at higher levels are hidden." (setq s (oref s parent)) (goto-char (oref s start))) (magit-section-show-children magit-root-section (1- level))) - (cl-do* ((s (magit-current-section) - (oref s parent)) - (i (1- (length (magit-section-ident s))) - (cl-decf i))) - ((cond ((< i level) (magit-section-show-children s (- level i 1)) t) - ((= i level) (magit-section-hide s) t)) - (magit-section-goto s))))) + (dolist (section (or (magit-region-sections) + (list (magit-current-section)))) + (cl-do* ((s section + (oref s parent)) + (i (1- (length (magit-section-ident s))) + (cl-decf i))) + ((cond ((< i level) (magit-section-show-children s (- level i 1)) t) + ((= i level) (magit-section-hide s) t)) + (magit-section-goto s)))))) (defun magit-section-show-level-1 () "Show surrounding sections on first level." @@ -1265,7 +1269,7 @@ of course you want to be that precise." (cl-assert condition) (and section (if (listp condition) - (--first (magit-section-match-1 it section) condition) + (seq-find (##magit-section-match-1 % section) condition) (magit-section-match-2 (if (symbolp condition) (list condition) (cl-coerce condition 'list)) @@ -1382,7 +1386,7 @@ a section by washing Git's output and Git didn't actually output anything this time around. \(fn [NAME] (CLASS &optional VALUE HIDE) &rest BODY)" - (declare (indent 1) + (declare (indent 1) ;sic (debug ([&optional symbolp] (&or [("eval" form) &optional form form &rest form] [symbolp &optional form form &rest form]) @@ -1390,7 +1394,7 @@ anything this time around. (pcase-let* ((bind (and (symbolp (car args)) (pop args))) (`((,class ,value ,hide . ,args) . ,body) args) - (obj (cl-gensym "section"))) + (obj (gensym "section"))) `(let* ((,obj (magit-insert-section--create ,(if (eq (car-safe class) 'eval) (cadr class) `',class) ,value ,hide ,@args)) @@ -1446,47 +1450,31 @@ anything this time around. (defun magit-insert-section--finish (obj) (run-hooks 'magit-insert-section-hook) - (let ((beg (oref obj start)) - (end (oset obj end - (if magit-section-inhibit-markers - (point) - (point-marker)))) - (props `( magit-section ,obj - ,@(and-let* ((map (symbol-value (oref obj keymap)))) - (list 'keymap map))))) - (unless magit-section-inhibit-markers - (set-marker-insertion-type beg t)) - (cond ((eq obj magit-root-section)) - ((oref obj children) - (magit-insert-child-count obj) - (magit-section-maybe-add-heading-map obj) - (save-excursion - (goto-char beg) - (while (< (point) end) - (let ((next (or (next-single-property-change - (point) 'magit-section) - end))) - (unless (magit-section-at) - (add-text-properties (point) next props)) - (goto-char next))))) - ((add-text-properties beg end props))) - (cond ((eq obj magit-root-section) - (when (eq magit-section-inhibit-markers 'delay) - (setq magit-section-inhibit-markers nil) - (magit-map-sections - (lambda (section) - (oset section start (copy-marker (oref section start) t)) - (oset section end (copy-marker (oref section end) t))))) - (let ((magit-section-cache-visibility nil)) - (magit-section-show obj))) - (magit-section-insert-in-reverse - (push obj (oref (oref obj parent) children))) - ((let ((parent (oref obj parent))) - (oset parent children - (nconc (oref parent children) - (list obj)))))) - (when magit-section-insert-in-reverse - (oset obj children (nreverse (oref obj children)))))) + (if magit-section-inhibit-markers + (oset obj end (point)) + (oset obj end (point-marker)) + (set-marker-insertion-type (oref obj start) t)) + (cond + ((eq obj magit-root-section) + (when (eq magit-section-inhibit-markers 'delay) + (setq magit-section-inhibit-markers nil) + (magit-map-sections + (lambda (section) + (oset section start (copy-marker (oref section start) t)) + (oset section end (copy-marker (oref section end) t)))))) + (t + (magit-section--set-section-properties obj) + (magit-section-maybe-add-heading-map obj) + (when (oref obj children) + (magit-insert-child-count obj)) + (if magit-section-insert-in-reverse + (push obj (oref (oref obj parent) children)) + (let ((parent (oref obj parent))) + (oset parent children + (nconc (oref parent children) + (list obj))))))) + (when magit-section-insert-in-reverse + (oset obj children (nreverse (oref obj children))))) (defun magit-cancel-section (&optional if-empty) "Cancel inserting the section that is currently being inserted. @@ -1572,9 +1560,9 @@ If the section is expanded when it is created, then this is like `progn'. Otherwise BODY isn't evaluated until the section is explicitly expanded." (declare (indent 0)) - (let ((f (cl-gensym)) - (s (cl-gensym)) - (l (cl-gensym))) + (let ((f (gensym)) + (s (gensym)) + (l (gensym))) `(let ((,f (lambda () ,@body))) (if (oref magit-insert-section--current hidden) (oset magit-insert-section--current washer @@ -1586,13 +1574,14 @@ is explicitly expanded." (funcall ,f) (dolist (s ,l) (set-marker-insertion-type (oref s end) nil)) + (magit-section--set-section-properties ,s) (magit-section-maybe-remove-heading-map ,s) (magit-section-maybe-remove-visibility-indicator ,s))))) (funcall ,f))))) (defun magit-insert-headers (hook) (let* ((header-sections nil) - (fn (lambda () (push magit-insert-section--current header-sections)))) + (fn (##push magit-insert-section--current header-sections))) (unwind-protect (progn (add-hook 'magit-insert-section-hook fn -90 t) @@ -1613,6 +1602,22 @@ is explicitly expanded." (magit-section-maybe-add-heading-map 1st-header))))) (remove-hook 'magit-insert-section-hook fn t)))) +(defun magit-section--set-section-properties (section) + (pcase-let* (((eieio start end children keymap) section) + (props `( magit-section ,section + ,@(and-let* ((map (symbol-value keymap))) + (list 'keymap map))))) + (if children + (save-excursion + (goto-char start) + (while (< (point) end) + (let ((next (or (next-single-property-change (point) 'magit-section) + end))) + (unless (magit-section-at) + (add-text-properties (point) next props)) + (goto-char next)))) + (add-text-properties start end props)))) + (defun magit-section-maybe-add-heading-map (section) (when (magit-section-content-p section) (let ((start (oref section start)) @@ -1663,8 +1668,23 @@ evaluated its BODY. Admittedly that's a bit of a hack." (delete-char 1) (insert (format "%s" count))))))) +(defun magit-section--opportunistic-wash (section) + (when-let ((washer (oref section washer))) + (oset section washer nil) + (let ((inhibit-read-only t) + (magit-insert-section--parent section) + (magit-insert-section--current section)) + (save-excursion + (goto-char (oref section end)) + (oset section content (point-marker)) + (funcall washer) + (oset section end (point-marker)))) + (setq magit-section-highlight-force-update t))) + ;;; Highlight +(defvar magit-section--refreshed-buffers nil) + (defun magit-section-pre-command-hook () (when (and (or magit--context-menu-buffer magit--context-menu-section) @@ -1678,8 +1698,10 @@ evaluated its BODY. Admittedly that's a bit of a hack." ;; after the menu is aborted. Here we can only make sure it is ;; updated afterwards. (magit-menu-highlight-point-section)) + (setq magit-section--refreshed-buffers nil) (setq magit-section-pre-command-region-p (region-active-p)) - (setq magit-section-pre-command-section (magit-current-section))) + (setq magit-section-pre-command-section (magit-current-section)) + (setq magit-section-focused-sections nil)) (defun magit-section-post-command-hook () (let ((window (selected-window))) @@ -1690,112 +1712,159 @@ evaluated its BODY. Admittedly that's a bit of a hack." (when (or magit--context-menu-buffer magit--context-menu-section) (magit-menu-highlight-point-section)))) - (unless (memq this-command '(magit-refresh magit-refresh-all)) - (magit-section-update-highlight))) + (unless (memq (current-buffer) magit-section--refreshed-buffers) + (magit-section-update-highlight)) + (setq magit-section--refreshed-buffers nil)) (defun magit-section-deactivate-mark () (setq magit-section-highlight-force-update t)) (defun magit-section-update-highlight (&optional force) - (let ((section (magit-current-section))) - (when (or force - magit-section-highlight-force-update - (xor magit-section-pre-command-region-p (region-active-p)) - (not (eq magit-section-pre-command-section section))) + (let ((section (magit-current-section)) + (focused (magit-focused-sections))) + (cond + ((or force + magit-section-highlight-force-update + (xor magit-section-pre-command-region-p (region-active-p)) + (not (eq magit-section-pre-command-section section))) (let ((inhibit-read-only t) (deactivate-mark nil) (selection (magit-region-sections))) (mapc #'delete-overlay magit-section-highlight-overlays) + (mapc #'delete-overlay magit-section-selection-overlays) (setq magit-section-highlight-overlays nil) - (setq magit-section-unhighlight-sections - magit-section-highlighted-sections) - (setq magit-section-highlighted-sections nil) - (if (and (fboundp 'long-line-optimizations-p) - (long-line-optimizations-p)) - (magit-section--enable-long-lines-shortcuts) - (unless (eq section magit-root-section) - (run-hook-with-args-until-success - 'magit-section-highlight-hook section selection)) - (dolist (s magit-section-unhighlight-sections) - (run-hook-with-args-until-success - 'magit-section-unhighlight-hook s selection))) + (setq magit-section-selection-overlays nil) + (cond ((magit-section--maybe-enable-long-lines-shortcuts)) + ((eq section magit-root-section)) + ((not magit-section-highlight-current) + (when selection + (magit-section-highlight-selection selection))) + ((not selection) + (magit-section-highlight section)) + (t + (mapc #'magit-section-highlight selection) + (magit-section-highlight-selection selection))) + (dolist (section (cl-union magit-section-highlighted-sections focused)) + (when (slot-boundp section 'painted) + (magit-section-update-paint section focused))) (restore-buffer-modified-p nil))) + ((and (eq magit-section-pre-command-section section) + magit-section-selection-overlays + (region-active-p) + (not (magit-region-sections))) + (mapc #'delete-overlay magit-section-selection-overlays) + (setq magit-section-selection-overlays nil))) (setq magit-section-highlight-force-update nil) (magit-section-maybe-paint-visibility-ellipses))) -(defun magit-section-highlight (section selection) - "Highlight SECTION and if non-nil all sections in SELECTION. -This function works for any section but produces undesirable -effects for diff related sections, which by default are -highlighted using `magit-diff-highlight'. Return t." - (when-let ((face (oref section heading-highlight-face))) - (dolist (section (or selection (list section))) - (magit-section-make-overlay - (oref section start) - (or (oref section content) - (oref section end)) - face))) - (cond (selection - (magit-section-make-overlay (oref (car selection) start) - (oref (car (last selection)) end) - 'magit-section-highlight) - (magit-section-highlight-selection nil selection)) - (t - (magit-section-make-overlay (oref section start) - (oref section end) - 'magit-section-highlight))) - t) - -(defun magit-section-highlight-selection (_ selection) - "Highlight the section-selection region. -If SELECTION is non-nil, then it is a list of sections selected by -the region. The headings of these sections are then highlighted. - -This is a fallback for people who don't want to highlight the -current section and therefore removed `magit-section-highlight' -from `magit-section-highlight-hook'. - -This function is necessary to ensure that a representation of -such a region is visible. If neither of these functions were -part of the hook variable, then such a region would be -invisible." - (when (and selection - (not (and (eq this-command 'mouse-drag-region)))) - (dolist (section selection) - (magit-section-make-overlay (oref section start) - (or (oref section content) - (oref section end)) - 'magit-section-heading-selection)) - t)) - -(defun magit-section-make-overlay (start end face) - ;; Yes, this doesn't belong here. But the alternative of - ;; spreading this hack across the code base is even worse. - (when (and magit-section-keep-region-overlay - (memq face '(magit-section-heading-selection - magit-diff-file-heading-selection - magit-diff-hunk-heading-selection))) - (setq face (list :foreground (face-foreground face)))) +(cl-defmethod magit-section-highlight ((section magit-section)) + (pcase-let* + (((eieio start content end children heading-highlight-face) section) + (headlight heading-highlight-face) + (selective (magit-section-selective-highlight-p section))) + (cond + (selective + (magit-section-highlight-range start (or content end) headlight) + (cond (children + (let ((child-start (oref (car children) start))) + (when (and content (< content child-start)) + (magit-section-highlight-range content child-start))) + (mapc #'magit-section-highlight children)) + ((and content (not (slot-boundp section 'painted))) + (magit-section-highlight-range content end)))) + (headlight + (magit-section-highlight-range start (or content end) headlight) + (when content + (magit-section-highlight-range (if headlight content start) end))) + ((magit-section-highlight-range start end))))) + +(defun magit-section-highlight-selection (selection) + (when magit-section-highlight-selection + (dolist (sibling selection) + (with-slots (start content end heading-selection-face) sibling + (let ((ov (make-overlay start (or content end) nil t))) + (overlay-put ov 'font-lock-face + (or heading-selection-face + 'magit-section-heading-selection)) + (overlay-put ov 'evaporate t) + (push ov magit-section-selection-overlays) + ov))))) + +(defun magit-section-highlight-range (start end &optional face) (let ((ov (make-overlay start end nil t))) - (overlay-put ov 'font-lock-face face) + (overlay-put ov 'font-lock-face (or face 'magit-section-highlight)) (overlay-put ov 'evaporate t) (push ov magit-section-highlight-overlays) ov)) +(defun magit-section-selective-highlight-p (section &optional as-child) + (or (oref section selective-highlight) + (and as-child + (oref section heading-highlight-face)) + (slot-boundp section 'painted) + (and-let* ((children (oref section children))) + (magit-section-selective-highlight-p (car children) t)))) + +;;; Paint + +(defun magit-section-update-paint (section focused-sections) + (cl-flet ((paint (highlight) + (let ((inhibit-read-only t)) + (save-excursion + (goto-char (oref section start)) + (magit-section-paint section highlight)))) + (unregister () + (setq magit-section-highlighted-sections + (delq section magit-section-highlighted-sections)))) + (if (magit-section-hidden section) + ;; If the section is highlighted but unfocused, it remains + ;; highlighted, but `magit-section--opportunistic-paint' via + ;; `magit-section-show' will unhighlight on expansion, and + ;; before then (or if a refresh occurs first) it doesn't matter. + (unregister) + (pcase (list (if (memq section focused-sections) 'focus 'unfocus) + (oref section painted)) + (`(focus ,(or 'nil 'plain)) + (paint t) + (cl-pushnew section magit-section-highlighted-sections)) + (`(unfocus ,(or 'nil 'highlight)) + (paint nil) + (unregister)) + ('(unfocus plain) + (unregister)))))) + +(cl-defmethod magit-section-paint ((section magit-section) _highlight) + (error "Slot `paint' bound but `magit-section-paint' not implemented for `%s'" + (eieio-object-class-name section))) + +(defun magit-section--opportunistic-paint (section) + (when (and (not (oref section hidden)) + (slot-boundp section 'painted)) + (if magit--refreshing-buffer-p + ;; Defer to `magit-section-update-highlight'. + (unless (oref section painted) + (cl-pushnew section magit-section-highlighted-sections)) + (magit-section-update-paint section (magit-focused-sections))))) + +;;; Long Lines + (defvar magit-show-long-lines-warning t) -(defun magit-section--enable-long-lines-shortcuts () - (message "Enabling long lines shortcuts in %S" (current-buffer)) - (kill-local-variable 'redisplay-highlight-region-function) - (kill-local-variable 'redisplay-unhighlight-region-function) - (when magit-show-long-lines-warning - (setq magit-show-long-lines-warning nil) - (display-warning 'magit (format "\ +(defun magit-section--maybe-enable-long-lines-shortcuts () + (and (fboundp 'long-line-optimizations-p) + (long-line-optimizations-p) + (prog1 t + (message "Enabling long lines shortcuts in %S" (current-buffer)) + (kill-local-variable 'redisplay-highlight-region-function) + (kill-local-variable 'redisplay-unhighlight-region-function) + (when magit-show-long-lines-warning + (setq magit-show-long-lines-warning nil) + (display-warning 'magit (format "\ Emacs has enabled redisplay shortcuts in this buffer because there are lines whose length go beyond -`long-line-threshold' \(%s characters). As a result, section +`long-line-threshold' (%s characters). As a result, section highlighting and the special appearance of the region has been -disabled. Some existing highlighting might remain in effect. +disabled. These shortcuts remain enabled, even once there no longer are any long lines in this buffer. To disable them again, kill @@ -1803,7 +1872,9 @@ and recreate the buffer. This message won't be shown for this session again. To disable it for all future sessions, set `magit-show-long-lines-warning' -to nil." (bound-and-true-p long-line-threshold)) :warning))) +to nil." (bound-and-true-p long-line-threshold)) :warning))))) + +;;; Successor (cl-defgeneric magit-section-get-relative-position (section)) @@ -1865,7 +1936,8 @@ to nil." (bound-and-true-p long-line-threshold)) :warning))) (defun magit-section--highlight-region (start end window rol) (magit-section--delete-region-overlays) - (if (and (not magit-section-keep-region-overlay) + (if (and magit-section-highlight-selection + (not magit-section-keep-region-overlay) (or (magit-region-sections) (run-hook-with-args-until-success 'magit-region-highlight-hook (magit-current-section))) @@ -1887,14 +1959,15 @@ to nil." (bound-and-true-p long-line-threshold)) :warning))) (put 'magit-section-visibility-cache 'permanent-local t) (defun magit-section-cached-visibility (section) - "Set SECTION's visibility to the cached value. -When `magit-section-preserve-visibility' is nil, do nothing." + "Return the visibility cached for SECTION. +When `magit-section-preserve-visibility' is nil, return nil." (and magit-section-preserve-visibility (cdr (assoc (magit-section-ident section) magit-section-visibility-cache)))) (cl-defun magit-section-cache-visibility (&optional (section magit-insert-section--current)) + "Cache SECTION's current visibility." (setf (compat-call alist-get (magit-section-ident section) magit-section-visibility-cache @@ -1951,8 +2024,8 @@ When `magit-section-preserve-visibility' is nil, do nothing." (setq magit--ellipses-sections (or (magit-region-sections) (list (magit-current-section)))))) - (beg (--map (oref it start) sections)) - (end (--map (oref it end) sections))) + (beg (mapcar (##oref % start) sections)) + (end (mapcar (##oref % end) sections))) (when (region-active-p) ;; This ensures that the region face is removed from ellipses ;; when the region becomes inactive, but fails to ensure that @@ -1970,8 +2043,8 @@ When `magit-section-preserve-visibility' is nil, do nothing." (propertize (car magit-section-visibility-indicator) 'font-lock-face (let ((pos (overlay-start ov))) - (delq nil (nconc (--map (overlay-get it 'font-lock-face) - (overlays-at pos)) + (delq nil (nconc (mapcar (##overlay-get % 'font-lock-face) + (overlays-at pos)) (list (get-char-property pos 'font-lock-face)))))))))))) @@ -2043,13 +2116,30 @@ excluding SECTION itself." ('next (cdr (member section siblings))) (_ (remq section siblings))))) +(defun magit-focused-sections () + "Return a list of the selected sections and all their descendants. +If no sections are selected return a list of the current section and +its descendants, except if that is the root section, in which case +return nil." + (or magit-section-focused-sections + (setq magit-section-focused-sections + (let ((current (magit-current-section))) + (and (not (eq current magit-root-section)) + (let (sections) + (letrec ((collect (lambda (section) + (mapc collect (oref section children)) + (push section sections)))) + (mapc collect + (or (magit-region-sections) (list current)))) + sections)))))) + (defun magit-region-values (&optional condition multiple) "Return a list of the values of the selected sections. Return the values that themselves would be returned by `magit-region-sections' (which see)." - (--map (oref it value) - (magit-region-sections condition multiple))) + (mapcar (##oref % value) + (magit-region-sections condition multiple))) (defun magit-region-sections (&optional condition multiple) "Return a list of the selected sections. @@ -2081,9 +2171,18 @@ forms CONDITION can take." (rend (region-end)) (sbeg (magit-section-at rbeg)) (send (magit-section-at rend))) - (and send + ;; It should be possible to select a single section using + ;; `set-mark-command', so don't use `use-region-p' above. + ;; We still have to prevent the selection overlay from + ;; being flashed when clicking inside a section, which + ;; the first condition accomplishes: + (and (or (not (eq this-command #'mouse-drag-region)) + (> rend rbeg)) + send (not (eq send magit-root-section)) - (not (and multiple (eq send sbeg))) + (not (and (eq send sbeg) + (or multiple + (> rend rbeg)))) (let ((siblings (cons sbeg (magit-section-siblings sbeg 'next))) (sections ())) (and (memq send siblings) @@ -2096,8 +2195,8 @@ forms CONDITION can take." (setq siblings nil))) (setq sections (nreverse sections)) (and (or (not condition) - (--all-p (magit-section-match condition it) - sections)) + (seq-every-p (##magit-section-match condition %) + sections)) sections)))))))) (defun magit-map-sections (function &optional section) @@ -2106,7 +2205,7 @@ If optional SECTION is non-nil, only map over that section and its descendants, otherwise map over all sections in the current buffer, ending with `magit-root-section'." (let ((section (or section magit-root-section))) - (mapc (lambda (child) (magit-map-sections function child)) + (mapc (##magit-map-sections function %) (oref section children)) (funcall function section))) @@ -2221,7 +2320,7 @@ Configuration'." (message "`%s' contains entries that are no longer valid. %s\nUsing standard value instead. Please re-configure hook variable." hook - (mapconcat (lambda (sym) (format " `%s'" sym)) invalid "\n")) + (mapconcat (##format " `%s'" %) invalid "\n")) (sit-for 5) (setq entries (eval (car (get hook 'standard-value))))) (dolist (entry entries) @@ -2258,11 +2357,24 @@ Configuration'." (throw 'missing nil)))) (not pos)))) -(defun magit--add-face-text-property (beg end face &optional append object) - "Like `add-face-text-property' but for `font-lock-face'." +(defun magit--add-face-text-property ( beg end face + &optional append object adopt-face) + "Like `add-face-text-property' but for `font-lock-face'. +If optional ADOPT-FACE, the replace `face' with `font-lock-face' +first. This is a hack, which is likely to be remove again." (when (stringp object) (unless beg (setq beg 0)) (unless end (setq end (length object)))) + (when adopt-face + (let ((beg beg) + (end end)) + (while (< beg end) + (let ((pos (next-single-property-change beg 'face object end)) + (val (get-text-property beg 'face object))) + ;; We simply assume font-lock-face is not also set. + (put-text-property beg pos 'font-lock-face val object) + (remove-list-of-text-properties beg pos '(face) object) + (setq beg pos))))) (while (< beg end) (let* ((pos (next-single-property-change beg 'font-lock-face object end)) (val (get-text-property beg 'font-lock-face object)) @@ -2327,9 +2439,8 @@ This is like moving to POS and then calling `pos-eol'." (magit-section-match magit--imenu-group-types section)) (and-let* ((children (oref section children))) `((,(magit--imenu-index-name section) - ,@(mapcar (lambda (s) - (cons (magit--imenu-index-name s) - (oref s start))) + ,@(mapcar (##cons (magit--imenu-index-name %) + (oref % start)) children)))))) (magit--imenu-item-types (and (magit-section-match magit--imenu-item-types section) @@ -2407,10 +2518,10 @@ and the buffer-local values of the variables referenced in its (bookmark-prop-set bookmark var (symbol-value var))) (bookmark-prop-set bookmark 'magit-hidden-sections - (--keep (and (oref it hidden) - (cons (oref it type) - (magit-bookmark--get-child-value it))) - (oref magit-root-section children))) + (seq-keep (##and (oref % hidden) + (cons (oref % type) + (magit-bookmark--get-child-value %))) + (oref magit-root-section children))) bookmark) (user-error "Bookmarking is not implemented for %s buffers" major-mode))) @@ -2449,7 +2560,7 @@ with the variables' values as arguments, which were recorded by (format "%s%s" (substring (symbol-name major-mode) 0 -5) (if-let ((vars (get major-mode 'magit-bookmark-variables))) - (mapcan (lambda (var) (ensure-list (symbol-value var))) vars) + (mapcan (##ensure-list (symbol-value %)) vars) ""))) ;;; Bitmaps diff --git a/elpa/magit-section-20250107.641/magit-section.info b/elpa/magit-section-20250518.653/magit-section.info similarity index 99% rename from elpa/magit-section-20250107.641/magit-section.info rename to elpa/magit-section-20250518.653/magit-section.info index e7e9adea..f6f1e4f3 100644 --- a/elpa/magit-section-20250107.641/magit-section.info +++ b/elpa/magit-section-20250518.653/magit-section.info @@ -34,7 +34,7 @@ packages that have nothing to do with Magit or Git. and user options see *note (magit)Sections::. This manual documents how you can use sections in your own packages. -This manual is for Magit-Section version 4.2.0. +This manual is for Magit-Section version 4.3.5. Copyright (C) 2015-2025 Jonas Bernoulli -- 2.47.3