diff --git a/docs/transient.org b/docs/transient.org index 1ddc011e..2cb6989a 100644 --- a/docs/transient.org +++ b/docs/transient.org @@ -1910,8 +1910,10 @@ They are defined here anyway to allow sharing certain methods. function that takes the object as the only argument and which returns a prompt string. -- ~choices~ A list of valid values. How exactly that is used depends on - the class of the object. +- ~choices~ A list of valid values, or a function that returns such a + list. The latter is not implemented for ~transient-switches~, because + I couldn't think of a use-case. How exactly the choices are used + varies depending on the class of the suffix. *** Slots of ~transient-variable~ :PROPERTIES: diff --git a/docs/transient.texi b/docs/transient.texi index b03f540a..14a9de6e 100644 --- a/docs/transient.texi +++ b/docs/transient.texi @@ -2191,8 +2191,10 @@ function that takes the object as the only argument and which returns a prompt string. @item -@code{choices} A list of valid values. How exactly that is used depends on -the class of the object. +@code{choices} A list of valid values, or a function that returns such a +list. The latter is not implemented for @code{transient-switches}, because +I couldn't think of a use-case. How exactly the choices are used +varies depending on the class of the suffix. @end itemize @anchor{Slots of @code{transient-variable}} diff --git a/lisp/transient.el b/lisp/transient.el index 65f507be..706a8943 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -2961,6 +2961,7 @@ it\", in which case it is pointless to preserve history.)" (oset obj value nil) (let* ((enable-recursive-minibuffers t) (reader (oref obj reader)) + (choices (if (functionp choices) (funcall choices) choices)) (prompt (transient-prompt obj)) (value (if multi-value (mapconcat #'identity value ",") value)) (history-key (or (oref obj history-key)