branch: elpa/magit
commit c8f5a93f44c4144a973e3a601538385111629291
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    magit-log{,-refresh}: Move shared arguments to new group variable
---
 lisp/magit-log.el | 121 +++++++++++++++++++++---------------------------------
 1 file changed, 47 insertions(+), 74 deletions(-)

diff --git a/lisp/magit-log.el b/lisp/magit-log.el
index 4c29f7e3bd9..5f4bae5623b 100644
--- a/lisp/magit-log.el
+++ b/lisp/magit-log.el
@@ -422,51 +422,57 @@ 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
+     ]))
+
 ;;;###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
-  ;; 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
+  [magit-log-infix-arguments]
   [["Log"
     ("l" "current"             magit-log-current)
     ("h" "HEAD"                magit-log-head)
@@ -498,40 +504,7 @@ commits before and half after."
   :man-page "git-log"
   :class 'magit-log-refresh-prefix
   [:if-mode magit-log-mode
-   :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)
-    (magit-log:-S)
-    (magit-log:-L)
-    (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")
-    ("-c" "Show graph in color"     "--color")
-    ("-d" "Show refnames"           "--decorate")
-    ("=S" "Show signatures"         "--show-signature")
-    ("-h" "Show header"             "++header")
-    ("-p" "Show diffs"              ("-p" "--patch"))
-    ("-s" "Show diffstats"          "--stat")]]
+   magit-log-infix-arguments]
   [:if-not-mode magit-log-mode
    :description "Arguments"
    (magit-log:-n)

Reply via email to