summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.el16
-rw-r--r--lisp/km-magit.el78
-rw-r--r--lisp/km-mail.el2
3 files changed, 48 insertions, 48 deletions
diff --git a/init.el b/init.el
index fd6cbd5..623b8d1 100644
--- a/init.el
+++ b/init.el
@@ -929,17 +929,11 @@
(setq magit-delete-by-moving-to-trash nil
magit-update-other-window-delay 0.1
magit-revision-insert-related-refs nil
- magit-use-sticky-arguments 'current
magit-log-show-refname-after-summary t
magit-log-section-arguments nil)
(setq magit-list-refs-sortby "-creatordate")
- (setq magit-log-arguments
- (cons "-n75" (cl-remove-if
- (lambda (x) (string-prefix-p "-n" x))
- magit-log-arguments)))
-
(setq magit-uniquify-buffer-names nil)
(setq magit-no-confirm '(stage-all-changes unstage-all-changes reverse))
@@ -955,8 +949,6 @@
(setq magit-branch-direct-configure nil)
- (setq magit-show-refs-arguments '("--sort=-committerdate"))
-
(remove-hook 'magit-refs-sections-hook #'magit-insert-tags)
(add-hook 'magit-log-mode-hook #'bug-reference-mode)
@@ -1009,6 +1001,14 @@
(transient-suffix-put 'magit-branch "m" :key "r")
(transient-suffix-put 'magit-branch "s" :key "v")
+ (setf (alist-get 'magit-show-refs transient-values)
+ (list "--sort=-committerdate"))
+
+ (put 'magit-log-mode 'magit-log-default-arguments
+ '("--graph" "-n75" "--decorate"))
+ (put 'magit-log-select-mode 'magit-log-default-arguments
+ '("--graph" "-n75" "--decorate"))
+
(advice-add
'magit-generate-buffer-name-default-function
:around
diff --git a/lisp/km-magit.el b/lisp/km-magit.el
index 952f785..39e70b1 100644
--- a/lisp/km-magit.el
+++ b/lisp/km-magit.el
@@ -354,8 +354,7 @@ N defaults to 20."
(defun km/magit-find-commit-file (commit)
"Find a file that changed in COMMIT."
(interactive (list (or (magit-branch-or-commit-at-point)
- (and (derived-mode-p 'magit-revision-mode)
- (car magit-refresh-args))
+ magit-buffer-revision
(magit-read-branch-or-commit "Commit"))))
(let ((files (magit-changed-files (format "%s~..%s" commit commit))))
(find-file
@@ -435,7 +434,7 @@ argument."
((memq (oref section type) '(commit branch))
(oref section value))
((derived-mode-p 'magit-revision-mode)
- (car magit-refresh-args))))
+ magit-buffer-revision)))
(magit-read-branch-or-commit "Revision"))))
(--when-let (and rev (magit-git-string "describe" rev))
(kill-new (message it))))
@@ -475,12 +474,12 @@ show tags by default."
(defun km/magit-log-flip-revs ()
"Swap the two revisions in a log's range."
(interactive)
- (let ((range (caar magit-refresh-args)))
+ (let ((range (car magit-buffer-revisions)))
(if (and range
(derived-mode-p 'magit-log-mode)
(string-match magit-range-re range))
(progn
- (setf (caar magit-refresh-args)
+ (setf (car magit-buffer-revisions)
(concat (match-string 3 range)
(match-string 2 range)
(match-string 1 range)))
@@ -489,10 +488,11 @@ show tags by default."
(defun km/magit-cherry-flip-revs ()
(interactive)
- (pcase-let ((`(,rev0 ,rev1) magit-refresh-args))
- (setf (nth 0 magit-refresh-args) rev1)
- (setf (nth 1 magit-refresh-args) rev0)
- (magit-refresh)))
+ (let ((r magit-buffer-refname)
+ (u magit-buffer-upstream))
+ (setq magit-buffer-upstream r)
+ (setq magit-buffer-refname u))
+ (magit-refresh))
(defun km/magit-flip-revs ()
(interactive)
@@ -508,8 +508,8 @@ show tags by default."
(interactive)
(unless (derived-mode-p 'magit-log-mode)
(user-error "Not in log buffer"))
- (setf (caar magit-refresh-args)
- (read-string "Range: " (caar magit-refresh-args)))
+ (setf (car magit-buffer-revisions)
+ (read-string "Range: " (car magit-buffer-revisions)))
(magit-refresh))
(defun km/magit-cherry-insert-in-upstream ()
@@ -518,7 +518,7 @@ show tags by default."
(magit-insert-heading "In upstream:")
(magit-git-wash (apply-partially 'magit-log-wash-log 'cherry)
"cherry" "-v" "--abbrev"
- (nth 1 magit-refresh-args) (nth 0 magit-refresh-args))))
+ magit-buffer-refname magit-buffer-upstream)))
(defun km/magit-cherry-toggle-upstream-section ()
(interactive)
@@ -542,11 +542,10 @@ OTHER-WINDOW corresponds to `magit-diff-visit-file's OTHER-WINDOW
argument. Interactively, this can be accessed using the command
`km/magit-diff-visit-file-other-window'."
(interactive "P")
- (let ((magit-refresh-args (if (and prev-rev
- (derived-mode-p 'magit-revision-mode))
- (cons (concat (car magit-refresh-args) "^")
- (cdr magit-refresh-args))
- magit-refresh-args))
+ (let ((magit-buffer-revision (if (and prev-rev
+ (derived-mode-p 'magit-revision-mode))
+ (concat magit-buffer-revision "^")
+ magit-buffer-revision))
(current-prefix-arg (and other-window (list 4))))
(call-interactively #'magit-diff-visit-file)))
@@ -584,31 +583,33 @@ argument. Interactively, this can be accessed using the command
(t
(concat ".." atpoint))))))
(--when-let (and (derived-mode-p 'magit-revision-mode)
- (car magit-refresh-args))
+ magit-buffer-revision)
(and (magit-rev-verify (concat it "^2"))
(concat it "^-1"))))))
(if range
- (magit-git-log (list range) args files)
+ (magit-log-setup-buffer (list range) args files)
(call-interactively #'magit-log-current))))
;;;###autoload
(defun km/magit-log-occurrence (beg end)
"Run `git log -S<content (BEG..END)> HEAD'."
(interactive "r")
- (magit-mode-setup-internal
- #'magit-log-mode
- (list (list "HEAD")
+ (with-current-buffer
+ (magit-setup-buffer #'magit-log-mode nil
+ (magit-buffer-revisions (list "HEAD"))
+ (magit-buffer-log-args
(cons (format "-S%s" (buffer-substring-no-properties beg end))
(cl-delete "-S" (car (magit-log-arguments))
- :test 'string-prefix-p))
- nil))
- (magit-log-goto-same-commit))
+ :test 'string-prefix-p)))
+ (magit-buffer-log-files nil))
+ (magit-log-goto-same-commit)
+ (current-buffer)))
(defun km/magit-cherry-dwim ()
(interactive)
(-let [(head . upstream)
(if (eq major-mode 'magit-log-mode)
- (let ((range (caar magit-refresh-args)))
+ (let ((range magit-buffer-revisions))
(and range
(string-match magit-range-re range)
(cons (match-string 3 range)
@@ -729,7 +730,7 @@ COMMIT."
(defun km/magit-copy-commit-summary-from-header (&optional _)
(when (magit-section-match 'headers)
- (km/magit-copy-commit-summary (car magit-refresh-args))))
+ (km/magit-copy-commit-summary magit-buffer-revision)))
(defun km/magit-copy-region-commits (&optional read-separator)
(--when-let (magit-region-values 'commit)
@@ -821,7 +822,7 @@ function."
(defun km/magit-github-commit-link ()
(--when-let (or (and (eq major-mode 'magit-revision-mode)
- (car magit-refresh-args))
+ magit-buffer-revision)
(and (derived-mode-p 'magit-mode)
(let ((sec (magit-current-section)))
(and (eq (oref sec type) 'commit)
@@ -832,17 +833,16 @@ function."
(defun km/magit-github-diff-link ()
(when (derived-mode-p 'magit-diff-mode)
- (let ((range (car magit-refresh-args)))
- (when (and range
- (string-match magit-range-re range))
- ;; This always converts to commits IDs. It could try to map
- ;; refnames to the appropriate GitHub link (including remotes
- ;; to forks), but I don't have much need for it at the moment.
- (let ((rev1 (magit-rev-parse (match-string 1 range)))
- (rev2 (magit-rev-parse (match-string 3 range))))
- (format "%s/compare/%s...%s"
- (or (km/magit-github-url) "")
- rev1 rev2))))))
+ (when (and magit-buffer-range
+ (string-match magit-range-re magit-buffer-range))
+ ;; This always converts to commits IDs. It could try to map
+ ;; refnames to the appropriate GitHub link (including remotes
+ ;; to forks), but I don't have much need for it at the moment.
+ (let ((rev1 (magit-rev-parse (match-string 1 magit-buffer-range)))
+ (rev2 (magit-rev-parse (match-string 3 magit-buffer-range))))
+ (format "%s/compare/%s...%s"
+ (or (km/magit-github-url) "")
+ rev1 rev2)))))
(defun km/magit-copy-github-link ()
"Copy a GitHub link from the current file or Magit buffer.
diff --git a/lisp/km-mail.el b/lisp/km-mail.el
index 8780b7d..a63c8bc 100644
--- a/lisp/km-mail.el
+++ b/lisp/km-mail.el
@@ -130,7 +130,7 @@ in the remote's \".git/config\" entry."
(when (or force-fetch
(not (magit-ref-exists-p local-ref)))
(magit-call-git "fetch" remote))
- (apply #'magit-log
+ (apply #'magit-log-setup-buffer
(list (concat base-ref ".." local-ref))
(magit-log-arguments))))