emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/git-commit 02630b5189 2/2: Define margin commands using tr


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 02630b5189 2/2: Define margin commands using transient-define-suffix
Date: Thu, 9 Nov 2023 18:59:43 -0500 (EST)

branch: elpa/git-commit
commit 02630b51896929011a420d9382779c98ecaef687
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    Define margin commands using transient-define-suffix
---
 lisp/magit-log.el    | 13 ++++++++-----
 lisp/magit-margin.el | 24 ++++++++++++++++--------
 lisp/magit-refs.el   |  6 +++++-
 3 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/lisp/magit-log.el b/lisp/magit-log.el
index c408acb192..606bca4ad8 100644
--- a/lisp/magit-log.el
+++ b/lisp/magit-log.el
@@ -540,10 +540,10 @@ commits before and half after."
     ("s" "buffer and set defaults"  transient-set-and-exit)
     ("w" "buffer and save defaults" transient-save-and-exit)]
    ["Margin"
-    ("L" "toggle visibility"        magit-toggle-margin           :transient t)
-    ("l" "cycle style"              magit-cycle-margin-style      :transient t)
-    ("d" "toggle details"           magit-toggle-margin-details   :transient t)
-    ("x" "toggle shortstat"         magit-toggle-log-margin-style :transient 
t)]
+    (magit-toggle-margin)
+    (magit-cycle-margin-style)
+    (magit-toggle-margin-details)
+    (magit-toggle-log-margin-style)]
    [:if-mode magit-log-mode
     :description "Toggle"
     ("b" "buffer lock"              magit-toggle-buffer-lock)]]
@@ -1567,9 +1567,12 @@ If there is no blob buffer in the same frame, then do 
nothing."
 
 (defvar-local magit-log-margin-show-shortstat nil)
 
-(defun magit-toggle-log-margin-style ()
+(transient-define-suffix magit-toggle-log-margin-style ()
   "Toggle between the regular and the shortstat margin style.
 The shortstat style is experimental and rather slow."
+  :description "Toggle shortstat"
+  :key "x"
+  :transient t
   (interactive)
   (setq magit-log-margin-show-shortstat
         (not magit-log-margin-show-shortstat))
diff --git a/lisp/magit-margin.el b/lisp/magit-margin.el
index 7eac41e7db..c69b84a51c 100644
--- a/lisp/magit-margin.el
+++ b/lisp/magit-margin.el
@@ -62,14 +62,16 @@ does not carry to other options."
   "Change what information is displayed in the margin."
   :info-manual "(magit) Log Margin"
   ["Margin"
-   ("L" "Toggle visibility" magit-toggle-margin      :transient t)
-   ("l" "Cycle style"       magit-cycle-margin-style :transient t)
-   ("d" "Toggle details"    magit-toggle-margin-details :transient t)
-   ("v" "Change verbosity"  magit-refs-set-show-commit-count
-    :if-derived magit-refs-mode)])
+   (magit-toggle-margin)
+   (magit-cycle-margin-style)
+   (magit-toggle-margin-details)
+   (magit-refs-set-show-commit-count)])
 
-(defun magit-toggle-margin ()
+(transient-define-suffix magit-toggle-margin ()
   "Show or hide the Magit margin."
+  :description "Toggle visibility"
+  :key "L"
+  :transient t
   (interactive)
   (unless (magit-margin-option)
     (user-error "Magit margin isn't supported in this buffer"))
@@ -79,8 +81,11 @@ does not carry to other options."
 (defvar magit-margin-default-time-format nil
   "See https://github.com/magit/magit/pull/4605.";)
 
-(defun magit-cycle-margin-style ()
+(transient-define-suffix magit-cycle-margin-style ()
   "Cycle style used for the Magit margin."
+  :description "Cycle style"
+  :key "l"
+  :transient t
   (interactive)
   (unless (magit-margin-option)
     (user-error "Magit margin isn't supported in this buffer"))
@@ -95,8 +100,11 @@ does not carry to other options."
           (_ 'age)))
   (magit-set-buffer-margin nil t))
 
-(defun magit-toggle-margin-details ()
+(transient-define-suffix magit-toggle-margin-details ()
   "Show or hide details in the Magit margin."
+  :description "Toggle details"
+  :key "d"
+  :transient t
   (interactive)
   (unless (magit-margin-option)
     (user-error "Magit margin isn't supported in this buffer"))
diff --git a/lisp/magit-refs.el b/lisp/magit-refs.el
index a097afe082..6b5cc87747 100644
--- a/lisp/magit-refs.el
+++ b/lisp/magit-refs.el
@@ -406,8 +406,12 @@ Compared with a branch read from the user."
                      (magit-show-refs-arguments)))
   (magit-refs-setup-buffer ref args))
 
-(defun magit-refs-set-show-commit-count ()
+(transient-define-suffix magit-refs-set-show-commit-count ()
   "Change for which refs the commit count is shown."
+  :description "Change verbosity"
+  :key "v"
+  :transient nil
+  :if-derived 'magit-refs-mode
   (interactive)
   (setq-local magit-refs-show-commit-count
               (magit-read-char-case "Show commit counts for " nil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]