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

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

[nongnu] elpa/git-commit 9c056d41a6 3/7: magit--git-variable:choices: Su


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 9c056d41a6 3/7: magit--git-variable:choices: Support changing global value
Date: Tue, 1 Mar 2022 08:58:18 -0500 (EST)

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

    magit--git-variable:choices: Support changing global value
    
    Instead of local value, not also.
---
 lisp/magit-transient.el | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/lisp/magit-transient.el b/lisp/magit-transient.el
index 85fad022d6..3b9873a7e6 100644
--- a/lisp/magit-transient.el
+++ b/lisp/magit-transient.el
@@ -156,25 +156,30 @@
 (cl-defmethod transient-format-value ((obj magit--git-variable:choices))
   (let* ((variable (oref obj variable))
          (choices  (oref obj choices))
-         (local    (magit-git-string "config" "--local"  variable))
+         (globalp  (oref obj global))
+         (value    nil)
          (global   (magit-git-string "config" "--global" variable))
          (default  (oref obj default))
          (fallback (oref obj fallback))
          (fallback (and fallback
                         (when-let ((val (magit-get fallback)))
                           (concat fallback ":" val)))))
+    (if (not globalp)
+        (setq value (magit-git-string "config" "--local"  variable))
+      (setq value global)
+      (setq global nil))
     (when (functionp choices)
       (setq choices (funcall choices)))
     (concat
      (propertize "[" 'face 'transient-inactive-value)
      (mapconcat (lambda (choice)
-                  (propertize choice 'face (if (equal choice local)
+                  (propertize choice 'face (if (equal choice value)
                                                (if (member choice choices)
                                                    'transient-value
                                                  'font-lock-warning-face)
                                              'transient-inactive-value)))
-                (if (and local (not (member local choices)))
-                    (cons local choices)
+                (if (and value (not (member value choices)))
+                    (cons value choices)
                   choices)
                 (propertize "|" 'face 'transient-inactive-value))
      (and (or global fallback default)
@@ -182,7 +187,7 @@
            (propertize "|" 'face 'transient-inactive-value)
            (cond (global
                   (propertize (concat "global:" global)
-                              'face (cond (local
+                              'face (cond (value
                                            'transient-inactive-value)
                                           ((member global choices)
                                            'transient-value)
@@ -190,12 +195,12 @@
                                            'font-lock-warning-face))))
                  (fallback
                   (propertize fallback
-                              'face (if local
+                              'face (if value
                                         'transient-inactive-value
                                       'transient-value)))
                  (default
                    (propertize (concat "default:" default)
-                               'face (if local
+                               'face (if value
                                          'transient-inactive-value
                                        'transient-value))))))
      (propertize "]" 'face 'transient-inactive-value))))



reply via email to

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