-
-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reusing infixes as readers in interactive forms, normalizing M-x and transient code paths #261
Comments
There's some good suggestions here. But please note that after the recent increase in activity here, I plan to work on Forge for the next few weeks, enjoy the holiday season, and then create releases in early January. Only after that do I intend to return to Transient. I do however plan to make Transient a primary focus at that time, and I do appreciate these suggestions. |
What's Forge? |
You can use |
The anonymous ones seem to recurse infinitely in 0.5.2. I can't try master until I update seq. Was beginning to look at how to implement this. We have an |
Yes, COMMAND has to be a symbol that identifies a infix command. I have improved the error you get when that is not the case, in 3ebb6ac. |
The vision is to make
(interactive)
forms in transient commands easier to write for both directly calling by M-x and via transient.It ends up looking like:
Instead, I propose enabling a form like this:
If the infix commands are made just a little smarter, they can call their reader and return the read value without using
transient-infix-value
. This has many advantages for reducing code size.transient-arg-value
.transient-current-command
is non-nil entirely.To implement, when the infix is called and the transient is active, it should behave normally. When called without a prefix, the infix should be initialized, call its reader, and return its value.
Calling customized infixes without an active prefix may require smarter
init-value
andinit-scope
functions, but the user is opting into this by writing the(interactive (list (infix) (infix) (infix))
style. I will avoid discussing providing more kinds of history for infixes to usually produce smart reader defaults, but this proposal would enhance potential value in that discussion.This usage pattern would also yield values without stringly typing values, eliminating the need to re-read them in the suffix. When providing alists for choices, we can use
assoc
instead ofassoc-string
and the even more brittle"my-value="
in calls totransient-args
.transient-args
itself relies on stringly typed information to locate the arg, and IMO should be mostly relied upon for CLI interfaces.However, CLI interfaces for new programs are not a good solution. When writing a new program, a JSON rpc style interface such as used by LSP or even an elisp extension with automatic serialization will lead to a less fragile Emacs <-> program interface. In this case, the stringly typing should be avoided and returning the infix value directly in interactive accomplishes this.
The text was updated successfully, but these errors were encountered: