I want to customize the title of a transient group based on the value of some variable, my--current-section. The following doesn't work
(transient-define-prefix my--prefix ()
"Sample docstring"
`[,(format "Manage (current section: %s)" my--current-section)
("c" "Configure" my--configure)
("o" "Open" my--open)
("s" "Submit" my--submit)
])
IIUC because transient-define-prefix is a macro, and it doesn't eval its arguments. Neither using (eval ...) works. Is this possible?
EDIT: What I want is to have the title of the transient group contain a string. To do this, the usual (?) way is to provide the title as the first element of the vector passed to transient-define-prefix, say
(transient-define-prefix my--prefix ()
"Sample docstring"
`["Group title"
("c" "Configure" my--configure)
("o" "Open" my--open)
("s" "Submit" my--submit)
])
If I try to use, in place of the string, some elisp code, this doesn't get evaluated, and instead interpreted as a generic transient option. Therefore
(transient-define-prefix my--prefix ()
"Sample docstring"
[,(format "Manage (current section: %s)" my--current-section)
("c" "Configure" my--configure)
("o" "Open" my--open)
("s" "Submit" my--submit)
])
interprets the , as the character to use as key, so I get the error (error "No key for ,").
Using eval like this
(transient-define-prefix my--prefix ()
"Sample docstring"
[(eval
(format "Manage (current section: %s)" my--current-section))
("c" "Configure" my--configure)
("o" "Open" my--open)
("s" "Submit" my--submit)
])
similarly, triggers (error "No key for eval").
Using backquoting
(transient-define-prefix my--prefix ()
"Sample docstring"
`[,(format "Manage (current section: %s)" my--current-section)
("c" "Configure" my--configure)
("o" "Open" my--open)
("s" "Submit" my--submit)
])
instead returns nil, and doesn't install the function.