branch: elpa/magit commit 9f0ab85903ee024f9e29d740ecf0525c9d96da6e Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Use new transient-define-group --- lisp/magit-diff.el | 50 +++++++++++++++---------------- lisp/magit-log.el | 88 ++++++++++++++++++++++++++---------------------------- 2 files changed, 67 insertions(+), 71 deletions(-) diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el index 8a62bead30..85459f6570 100644 --- a/lisp/magit-diff.el +++ b/lisp/magit-diff.el @@ -897,37 +897,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) @@ -943,7 +941,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) diff --git a/lisp/magit-log.el b/lisp/magit-log.el index 5166617bf9..f28b9d90c2 100644 --- a/lisp/magit-log.el +++ b/lisp/magit-log.el @@ -443,57 +443,54 @@ 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" + (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 ;;;###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] + [:class transient-subgroups magit-log-infix-arguments] [["Log" ("l" magit-log-current) ("o" "other" magit-log-other) @@ -523,6 +520,7 @@ commits before and half after." :man-page "git-log" :class 'magit-log-refresh-prefix [:if-mode magit-log-mode + :class transient-subgroups magit-log-infix-arguments] [:if-not-mode magit-log-mode :description "Arguments"