diff --git a/lisp/transient.el b/lisp/transient.el index 8cdd1aa3..3bf2307c 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -2936,7 +2936,7 @@ limited number of possible values should you replace this with a simple method that does not handle history. (E.g., for a command line switch the only possible values are \"use it\" and \"don't use it\", in which case it is pointless to preserve history.)" - (with-slots (value multi-value always-read allow-empty choices) obj + (with-slots (value multi-value always-read allow-empty) obj (if (and value (not multi-value) (not always-read) @@ -2958,6 +2958,7 @@ it\", in which case it is pointless to preserve history.)" (history (if initial-input (cons 'transient--history 1) 'transient--history)) + (choices (transient-infix-choices obj)) (value (cond (reader (funcall reader prompt initial-input history)) @@ -2988,7 +2989,7 @@ it\", in which case it is pointless to preserve history.)" "Cycle through the mutually exclusive switches. The last value is \"don't use any of these switches\"." (let ((choices (mapcar (apply-partially #'format (oref obj argument-format)) - (oref obj choices)))) + (transient-infix-choices obj)))) (if-let ((value (oref obj value))) (cadr (member value choices)) (car choices)))) @@ -3245,6 +3246,12 @@ value of the variable. I.e., this is a side-effect and does not contribute to the value of the transient." nil) +(cl-defmethod transient-infix-choices ((obj transient-infix)) + (let ((choices (oref obj choices))) + (if (functionp choices) + (oset obj choices (funcall choices obj)) + choices))) + ;;;; Utilities (defun transient-arg-value (arg args) @@ -3686,7 +3693,7 @@ If the OBJ's `key' is currently unreachable, then apply the face (propertize argument 'face 'transient-inactive-value)))) (cl-defmethod transient-format-value ((obj transient-switches)) - (with-slots (value argument-format choices) obj + (with-slots (value argument-format) obj (format (propertize argument-format 'face (if value 'transient-value @@ -3699,7 +3706,7 @@ If the OBJ's `key' is currently unreachable, then apply the face (if (equal (format argument-format choice) value) 'transient-value 'transient-inactive-value))) - choices + (transient-infix-choices obj) (propertize "|" 'face 'transient-inactive-value)) (propertize "]" 'face 'transient-inactive-value)))))