branch: elpa/git-commit
commit 0bbf31a2efd769ac2a4734358b4da08a596e9514
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>

    magit--git-variable:choices: Support fallback instead of default
    
    This is for `forge-forge.remote'.  There no longer is a constant
    default for the Git variable `forge.remote'.  Instead Forge tries to
    guess which remote likely is the upstream if `forge.remote' isn't set
    explicitly.  Use the "dwim:" prefix instead of "default:" to hint at
    this.
---
 lisp/magit-transient.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/magit-transient.el b/lisp/magit-transient.el
index 52745b4e9e..3957e51b73 100644
--- a/lisp/magit-transient.el
+++ b/lisp/magit-transient.el
@@ -169,7 +169,8 @@
          (globalp  (oref obj global))
          (value    nil)
          (global   (magit-git-string "config" "--global" variable))
-         (default  (oref obj default))
+         (defaultp (oref obj default))
+         (default  (if (functionp defaultp) (funcall defaultp obj) defaultp))
          (fallback (oref obj fallback))
          (fallback (and fallback
                         (when-let ((val (magit-get fallback)))
@@ -209,7 +210,9 @@
                                         'transient-inactive-value
                                       'transient-value)))
                  (default
-                  (propertize (concat "default:" default)
+                  (propertize (if (functionp defaultp)
+                                  (concat "dwim:" default)
+                                (concat "default:" default))
                               'face (if value
                                         'transient-inactive-value
                                       'transient-value))))))

Reply via email to