branch: elpa/magit
commit afa417fec7f3178b3f38fb14b07b713506cc230d
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-jump-to-revision-diffstat: Define using transient-define-suffix
The next commit will make changes that `magit-define-section-jumper'
does not support.
---
lisp/magit-diff.el | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 9e571e7b708..5e5522adcdd 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -1999,8 +1999,19 @@ like 'magit-jump-to-diffstat-or-diff'."
(magit-define-section-jumper magit-jump-to-revision-notes
"Notes" notes nil magit-insert-revision-notes)
-(magit-define-section-jumper magit-jump-to-revision-diffstat
- "Diffstat" diffstat nil magit-insert-revision-diff)
+(transient-define-suffix magit-jump-to-revision-diffstat (&optional expand)
+ :description "Diffstat"
+ :inapt-if-not (##cl-find-if (##eq (oref % type) 'diffstat)
+ (oref magit-root-section children))
+ (interactive "P")
+ (cond-let
+ ([section (cl-find-if (##eq (oref % type) 'diffstat)
+ (oref magit-root-section children))]
+ (goto-char (oref section start))
+ (when expand
+ (with-local-quit (magit-section-show section))
+ (recenter 0)))
+ ((message (format "No diff sections found")))))
(transient-define-suffix magit-jump-to-revision-diff (&optional expand)
:description "Diff"