Function: magit--git-variable-list-choices

magit--git-variable-list-choices is a byte-compiled function defined in magit-transient.el.

Signature

(magit--git-variable-list-choices OBJ)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-transient.el
(defun magit--git-variable-list-choices (obj)
  (let* ((variable (oref obj variable))
         (choices  (oref obj choices))
         (value    (oref obj value))
         (global   (and (not (oref obj global))
                        (magit-git-string "config" "--global" variable)))
         (defaultp (oref obj default))
         (default  (if (functionp defaultp) (funcall defaultp obj) defaultp))
         (fallback (oref obj fallback))
         (fallback (and fallback
                        (and$ (magit-get fallback)
                              (concat fallback ":" $)))))
    (when (functionp choices)
      (setq choices (funcall choices)))
    (cons (cond (global
                 (propertize (concat "global:" global)
                             'face (cond (value
                                          'transient-inactive-value)
                                         ((member global choices)
                                          'transient-value)
                                         ('font-lock-warning-face))))
                (fallback
                 (propertize fallback
                             'face (if value
                                       'transient-inactive-value
                                     'transient-value)))
                (default
                 (propertize (if (functionp defaultp)
                                 (concat "dwim:" default)
                               (concat "default:" default))
                             'face (if value
                                       'transient-inactive-value
                                     'transient-value))))
          (mapcar (lambda (choice)
                    (propertize choice 'face (if (equal choice value)
                                                 (if (member choice choices)
                                                     'transient-value
                                                   'font-lock-warning-face)
                                               'transient-inactive-value)))
                  (if (and value (not (member value choices)))
                      (cons value choices)
                    choices)))))