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

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

[nongnu] elpa/magit 1c30bb1f9f 03/28: Use transient-scope


From: Jonas Bernoulli
Subject: [nongnu] elpa/magit 1c30bb1f9f 03/28: Use transient-scope
Date: Fri, 6 Dec 2024 17:17:02 -0500 (EST)

branch: elpa/magit
commit 1c30bb1f9fb0668ec385fc3fb899b30d5507fad8
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    Use transient-scope
---
 lisp/magit-branch.el | 21 ++++++++-------------
 lisp/magit-remote.el |  7 ++-----
 2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/lisp/magit-branch.el b/lisp/magit-branch.el
index ad1ebea8ea..3ebda3fb94 100644
--- a/lisp/magit-branch.el
+++ b/lisp/magit-branch.el
@@ -208,14 +208,11 @@ has to be used to view and change branch related 
variables."
 (transient-define-prefix magit-branch (branch)
   "Add, configure or remove a branch."
   :man-page "git-branch"
-  [:if (lambda ()
-         (and magit-branch-direct-configure
-              (oref (transient-prefix-object) scope)))
+  [:if (lambda () (and magit-branch-direct-configure (transient-scope)))
    :description
    (lambda ()
      (concat (propertize "Configure " 'face 'transient-heading)
-             (propertize (oref (transient-prefix-object) scope)
-                         'face 'magit-branch-local)))
+             (propertize (transient-scope) 'face 'magit-branch-local)))
    ("d" magit-branch.<branch>.description)
    ("u" magit-branch.<branch>.merge/remote)
    ("r" magit-branch.<branch>.rebase)
@@ -859,8 +856,7 @@ and also rename the respective reflog file."
   [:description
    (lambda ()
      (concat (propertize "Configure " 'face 'transient-heading)
-             (propertize (oref (transient-prefix-object) scope)
-                         'face 'magit-branch-local)))
+             (propertize (transient-scope) 'face 'magit-branch-local)))
    ("d" magit-branch.<branch>.description)
    ("u" magit-branch.<branch>.merge/remote)
    ("r" magit-branch.<branch>.rebase)
@@ -903,7 +899,7 @@ and also rename the respective reflog file."
   :class 'magit--git-branch:upstream)
 
 (cl-defmethod transient-init-value ((obj magit--git-branch:upstream))
-  (when-let* ((branch (oref (transient-prefix-object) scope))
+  (when-let* ((branch (transient-scope))
               (remote (magit-get "branch" branch "remote"))
               (merge  (magit-get "branch" branch "merge")))
     (oset obj value (list remote merge))))
@@ -911,20 +907,19 @@ and also rename the respective reflog file."
 (cl-defmethod transient-infix-read ((obj magit--git-branch:upstream))
   (if (oref obj value)
       (oset obj value nil)
-    (magit-read-upstream-branch (oref (transient-prefix-object) scope)
-                                "Upstream")))
+    (magit-read-upstream-branch (transient-scope) "Upstream")))
 
 (cl-defmethod transient-infix-set ((obj magit--git-branch:upstream) refname)
-  (magit-set-upstream-branch (oref (transient-prefix-object) scope) refname)
+  (magit-set-upstream-branch (transient-scope) refname)
   (oset obj value
-        (and-let* ((branch (oref (transient-prefix-object) scope))
+        (and-let* ((branch (transient-scope))
                    (r (magit-get "branch" branch "remote"))
                    (m (magit-get "branch" branch "merge")))
           (list r m)))
   (magit-refresh))
 
 (cl-defmethod transient-format ((obj magit--git-branch:upstream))
-  (let ((branch (oref (transient-prefix-object) scope)))
+  (let ((branch (transient-scope)))
     (format-spec
      (oref obj format)
      `((?k . ,(transient-format-key obj))
diff --git a/lisp/magit-remote.el b/lisp/magit-remote.el
index 2cf913cffd..3f9aa429ba 100644
--- a/lisp/magit-remote.el
+++ b/lisp/magit-remote.el
@@ -68,9 +68,7 @@ has to be used to view and change remote related variables."
   :man-page "git-remote"
   :value '("-f")
   ["Variables"
-   :if (lambda ()
-         (and magit-remote-direct-configure
-              (oref (transient-prefix-object) scope)))
+   :if (lambda () (and magit-remote-direct-configure (transient-scope)))
    ("u" magit-remote.<remote>.url)
    ("U" magit-remote.<remote>.fetch)
    ("s" magit-remote.<remote>.pushurl)
@@ -315,8 +313,7 @@ refspec."
   [:description
    (lambda ()
      (concat (propertize "Configure " 'face 'transient-heading)
-             (propertize (oref (transient-prefix-object) scope)
-                         'face 'magit-branch-remote)))
+             (propertize (transient-scope) 'face 'magit-branch-remote)))
    ("u" magit-remote.<remote>.url)
    ("U" magit-remote.<remote>.fetch)
    ("s" magit-remote.<remote>.pushurl)



reply via email to

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