update packages
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
;;; Git Tools
|
||||
;;;; Git-Mergetool
|
||||
|
||||
;;;###autoload (autoload 'magit-git-mergetool "magit-extras" nil t)
|
||||
;;;###autoload(autoload 'magit-git-mergetool "magit-extras" nil t)
|
||||
(transient-define-prefix magit-git-mergetool (file args &optional transient)
|
||||
"Resolve conflicts in FILE using \"git mergetool --gui\".
|
||||
With a prefix argument allow changing ARGS using a transient
|
||||
@@ -205,9 +205,6 @@ to nil before loading Magit to prevent \"m\" from being bound.")
|
||||
|
||||
(with-eval-after-load 'project
|
||||
(when (and magit-bind-magit-project-status
|
||||
;; Added in Emacs 28.1.
|
||||
(boundp 'project-prefix-map)
|
||||
(boundp 'project-switch-commands)
|
||||
;; Only modify if it hasn't already been modified.
|
||||
(equal project-switch-commands
|
||||
(eval (car (get 'project-switch-commands 'standard-value))
|
||||
@@ -282,7 +279,7 @@ with two prefix arguments remove ignored files only.
|
||||
(1 "untracked")
|
||||
(4 "untracked and ignored")
|
||||
(_ "ignored"))))
|
||||
(magit-wip-commit-before-change)
|
||||
(magit-run-before-change-functions nil "clean")
|
||||
(magit-run-git "clean" "-f" "-d" (pcase arg (4 "-x") (16 "-X")))))
|
||||
|
||||
(put 'magit-clean 'disabled t)
|
||||
@@ -335,10 +332,7 @@ a position in a file-visiting buffer."
|
||||
(prompt-for-change-log-name)))
|
||||
(pcase-let ((`(,buf ,pos) (magit-diff-visit-file--noselect)))
|
||||
(magit--with-temp-position buf pos
|
||||
(let ((add-log-buffer-file-name-function
|
||||
(lambda ()
|
||||
(or magit-buffer-file-name
|
||||
(buffer-file-name)))))
|
||||
(let ((add-log-buffer-file-name-function #'magit-buffer-file-name))
|
||||
(add-change-log-entry whoami file-name other-window)))))
|
||||
|
||||
;;;###autoload
|
||||
@@ -396,7 +390,7 @@ points at it) otherwise."
|
||||
(put 'magit-edit-line-commit 'disabled t)
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-diff-edit-hunk-commit (file)
|
||||
(defun magit-diff-edit-hunk-commit ()
|
||||
"From a hunk, edit the respective commit and visit the file.
|
||||
|
||||
First visit the file being modified by the hunk at the correct
|
||||
@@ -413,10 +407,10 @@ to be visited.
|
||||
Neither the blob nor the file buffer are killed when finishing
|
||||
the rebase. If that is undesirable, then it might be better to
|
||||
use `magit-rebase-edit-commit' instead of this command."
|
||||
(interactive (list (magit-file-at-point t t)))
|
||||
(interactive)
|
||||
(let ((magit-diff-visit-previous-blob nil))
|
||||
(with-current-buffer
|
||||
(magit-diff-visit-file--internal file nil #'pop-to-buffer-same-window)
|
||||
(magit-diff-visit-file--internal nil #'pop-to-buffer-same-window)
|
||||
(magit-edit-line-commit))))
|
||||
|
||||
(put 'magit-diff-edit-hunk-commit 'disabled t)
|
||||
@@ -609,47 +603,45 @@ the minibuffer too."
|
||||
default-directory))
|
||||
(push (caar magit-revision-stack) magit-revision-history)
|
||||
(pop magit-revision-stack)))
|
||||
(if rev
|
||||
(pcase-let ((`(,pnt-format ,eob-format ,idx-format)
|
||||
magit-pop-revision-stack-format))
|
||||
(let ((default-directory toplevel)
|
||||
(idx (and idx-format
|
||||
(save-excursion
|
||||
(if (re-search-backward idx-format nil t)
|
||||
(number-to-string
|
||||
(1+ (string-to-number (match-string 1))))
|
||||
"1"))))
|
||||
pnt-args eob-args)
|
||||
(when (listp pnt-format)
|
||||
(setq pnt-args (cdr pnt-format))
|
||||
(setq pnt-format (car pnt-format)))
|
||||
(when (listp eob-format)
|
||||
(setq eob-args (cdr eob-format))
|
||||
(setq eob-format (car eob-format)))
|
||||
(when pnt-format
|
||||
(when idx-format
|
||||
(setq pnt-format
|
||||
(string-replace "%N" idx pnt-format)))
|
||||
(magit-rev-insert-format pnt-format rev pnt-args)
|
||||
(delete-char -1))
|
||||
(when eob-format
|
||||
(when idx-format
|
||||
(setq eob-format
|
||||
(string-replace "%N" idx eob-format)))
|
||||
(save-excursion
|
||||
(goto-char (point-max))
|
||||
(skip-syntax-backward ">-")
|
||||
(beginning-of-line)
|
||||
(if (and comment-start (looking-at comment-start))
|
||||
(while (looking-at comment-start)
|
||||
(forward-line -1))
|
||||
(forward-line)
|
||||
(unless (= (current-column) 0)
|
||||
(insert ?\n)))
|
||||
(insert ?\n)
|
||||
(magit-rev-insert-format eob-format rev eob-args)
|
||||
(delete-char -1)))))
|
||||
(user-error "Revision stack is empty")))
|
||||
(unless rev
|
||||
(user-error "Revision stack is empty"))
|
||||
(pcase-let ((`(,pnt-format ,eob-format ,idx-format)
|
||||
magit-pop-revision-stack-format))
|
||||
(let ((default-directory toplevel)
|
||||
(idx (and idx-format
|
||||
(if (save-excursion
|
||||
(re-search-backward idx-format nil t))
|
||||
(number-to-string (1+ (string-to-number (match-str 1))))
|
||||
"1")))
|
||||
(pnt-args nil)
|
||||
(eob-args nil))
|
||||
(when (listp pnt-format)
|
||||
(setq pnt-args (cdr pnt-format))
|
||||
(setq pnt-format (car pnt-format)))
|
||||
(when (listp eob-format)
|
||||
(setq eob-args (cdr eob-format))
|
||||
(setq eob-format (car eob-format)))
|
||||
(when pnt-format
|
||||
(when idx-format
|
||||
(setq pnt-format (string-replace "%N" idx pnt-format)))
|
||||
(magit-rev-insert-format pnt-format rev pnt-args)
|
||||
(delete-char -1))
|
||||
(when eob-format
|
||||
(when idx-format
|
||||
(setq eob-format (string-replace "%N" idx eob-format)))
|
||||
(save-excursion
|
||||
(goto-char (point-max))
|
||||
(skip-syntax-backward ">-")
|
||||
(beginning-of-line)
|
||||
(if (and comment-start (looking-at comment-start))
|
||||
(while (looking-at comment-start)
|
||||
(forward-line -1))
|
||||
(forward-line)
|
||||
(unless (= (current-column) 0)
|
||||
(insert ?\n)))
|
||||
(insert ?\n)
|
||||
(magit-rev-insert-format eob-format rev eob-args)
|
||||
(delete-char -1))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-copy-section-value (arg)
|
||||
@@ -675,42 +667,41 @@ a hunk, then strip the diff marker column and keep only either
|
||||
the added or removed lines, depending on the sign of the prefix
|
||||
argument."
|
||||
(interactive "P")
|
||||
(cond
|
||||
((and arg
|
||||
(magit-section-internal-region-p)
|
||||
(magit-section-match 'hunk))
|
||||
(kill-new
|
||||
(thread-last (buffer-substring-no-properties
|
||||
(region-beginning)
|
||||
(region-end))
|
||||
(replace-regexp-in-string
|
||||
(format "^\\%c.*\n?" (if (< (prefix-numeric-value arg) 0) ?+ ?-))
|
||||
"")
|
||||
(replace-regexp-in-string "^[ +-]" "")))
|
||||
(deactivate-mark))
|
||||
((use-region-p)
|
||||
(call-interactively #'copy-region-as-kill))
|
||||
(t
|
||||
(when-let* ((section (magit-current-section))
|
||||
(value (oref section value)))
|
||||
(magit-section-case
|
||||
((branch commit module-commit tag)
|
||||
(let ((default-directory default-directory) ref)
|
||||
(magit-section-case
|
||||
((branch tag)
|
||||
(setq ref value))
|
||||
(module-commit
|
||||
(setq default-directory
|
||||
(file-name-as-directory
|
||||
(expand-file-name (magit-section-parent-value section)
|
||||
(magit-toplevel))))))
|
||||
(setq value (magit-rev-parse
|
||||
(and magit-copy-revision-abbreviated "--short")
|
||||
value))
|
||||
(push (list value default-directory) magit-revision-stack)
|
||||
(kill-new (message "%s" (or (and current-prefix-arg ref)
|
||||
value)))))
|
||||
(t (kill-new (message "%s" value))))))))
|
||||
(cond-let*
|
||||
((and arg
|
||||
(magit-section-internal-region-p)
|
||||
(magit-section-match 'hunk))
|
||||
(kill-new
|
||||
(thread-last (buffer-substring-no-properties
|
||||
(region-beginning)
|
||||
(region-end))
|
||||
(replace-regexp-in-string
|
||||
(format "^\\%c.*\n?" (if (< (prefix-numeric-value arg) 0) ?+ ?-))
|
||||
"")
|
||||
(replace-regexp-in-string "^[ +-]" "")))
|
||||
(deactivate-mark))
|
||||
((use-region-p)
|
||||
(call-interactively #'copy-region-as-kill))
|
||||
([section (magit-current-section)]
|
||||
[value (oref section value)]
|
||||
(magit-section-case
|
||||
((branch commit module-commit tag)
|
||||
(let ((default-directory default-directory) ref)
|
||||
(magit-section-case
|
||||
((branch tag)
|
||||
(setq ref value))
|
||||
(module-commit
|
||||
(setq default-directory
|
||||
(file-name-as-directory
|
||||
(expand-file-name (magit-section-parent-value section)
|
||||
(magit-toplevel))))))
|
||||
(setq value (magit-rev-parse
|
||||
(and magit-copy-revision-abbreviated "--short")
|
||||
value))
|
||||
(push (list value default-directory) magit-revision-stack)
|
||||
(kill-new (message "%s" (or (and current-prefix-arg ref)
|
||||
value)))))
|
||||
(t (kill-new (message "%s" value)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun magit-copy-buffer-revision ()
|
||||
@@ -739,22 +730,23 @@ When `magit-copy-revision-abbreviated' is non-nil, save the
|
||||
abbreviated revision to the `kill-ring' and the
|
||||
`magit-revision-stack'."
|
||||
(interactive)
|
||||
(if (use-region-p)
|
||||
(call-interactively #'copy-region-as-kill)
|
||||
(when-let ((rev (or magit-buffer-revision
|
||||
(cl-case major-mode
|
||||
(magit-diff-mode
|
||||
(if (string-match "\\.\\.\\.?\\(.+\\)"
|
||||
magit-buffer-range)
|
||||
(match-string 1 magit-buffer-range)
|
||||
magit-buffer-range))
|
||||
(magit-status-mode "HEAD")))))
|
||||
(when (magit-commit-p rev)
|
||||
(setq rev (magit-rev-parse
|
||||
(and magit-copy-revision-abbreviated "--short")
|
||||
rev))
|
||||
(push (list rev default-directory) magit-revision-stack)
|
||||
(kill-new (message "%s" rev))))))
|
||||
(cond-let*
|
||||
((use-region-p)
|
||||
(call-interactively #'copy-region-as-kill))
|
||||
([rev (or magit-buffer-revision
|
||||
(cl-case major-mode
|
||||
(magit-diff-mode
|
||||
(if (string-match "\\.\\.\\.?\\(.+\\)"
|
||||
magit-buffer-range)
|
||||
(match-str 1 magit-buffer-range)
|
||||
magit-buffer-range))
|
||||
(magit-status-mode "HEAD")))]
|
||||
[_(magit-commit-p rev)]
|
||||
(setq rev (magit-rev-parse
|
||||
(and magit-copy-revision-abbreviated "--short")
|
||||
rev))
|
||||
(push (list rev default-directory) magit-revision-stack)
|
||||
(kill-new (message "%s" rev)))))
|
||||
|
||||
;;; Buffer Switching
|
||||
|
||||
@@ -835,4 +827,15 @@ In Magit diffs, also skip over - and + at the beginning of the line."
|
||||
|
||||
;;; _
|
||||
(provide 'magit-extras)
|
||||
;; Local Variables:
|
||||
;; read-symbol-shorthands: (
|
||||
;; ("and$" . "cond-let--and$")
|
||||
;; ("and>" . "cond-let--and>")
|
||||
;; ("and-let" . "cond-let--and-let")
|
||||
;; ("if-let" . "cond-let--if-let")
|
||||
;; ("when-let" . "cond-let--when-let")
|
||||
;; ("while-let" . "cond-let--while-let")
|
||||
;; ("match-string" . "match-string")
|
||||
;; ("match-str" . "match-string-no-properties"))
|
||||
;; End:
|
||||
;;; magit-extras.el ends here
|
||||
|
||||
Reference in New Issue
Block a user