How to use :show-help when defining a new prefix? #309
-
I'm trying to define a new prefix for a command that doesn't have a man-page, but I'm having trouble figuring out how This is what I have so far: (transient-define-prefix gt-create ()
"Create a new branch"
:show-help (lambda (obj) (debug(obj)))
["Arguments"
("-a" "Stage all unstaged changes before creating the branch, including to untracked files." "--all")]
["Actions"
("a" "Create" gt-create)]
(interactive)
(transient-setup 'gt-create)) Which gives me the following output in my messages:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
The error message is due to a defect in your code that has nothing to do with Transient: (lambda (obj) (debug (obj))
==error==> (void-function obj)
What you probably wanted to do is: :show-help (lambda (obj) (message "Let's test what obj looks like: %S" obj)) |
Beta Was this translation helpful? Give feedback.
-
You're right, thank you very much. |
Beta Was this translation helpful? Give feedback.
-
If added a new macro for this in 5fcd713, along with some documentation. A basic example: (transient-define-prefix demo ()
:show-help (lambda (_)
(transient-with-help-window
(process-file "ls" nil t nil "--help")))
[(transient-echo-arguments)]) |
Beta Was this translation helpful? Give feedback.
The error message is due to a defect in your code that has nothing to do with Transient:
obj
is in "function position" and thus called as a function, but there is no function namedobj
here, just a variable by that name.What you probably wanted to do is: