-
Notifications
You must be signed in to change notification settings - Fork 201
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
gptel-transient: Return to menu with just RET #695
Conversation
Modifying the history like this seems like a cursed solution, guaranteed to bite us in the back in the future when Transient updates. I'd like to make the value of the provider infix be a string (the backend name or backend-name:model-name), then the problem should disappear for good. Any idea if we can do that? I haven't looked at this code in a while. |
I agree it feels like a hack, OTOH not sure how it could break even more, since I don't think the actual semantics Transient closed magit/transient#172 without fixing transient.el. Do you agree with the second fix? Now if the user does |
Yeah the fix for the second issue looks fine at first glance, but I need to
think about it a bit.
For the main issue I have an idea for fixing it at the root, in the custom
transient class used by the infix. Both the backend and model need to be
set by side effect (instead of just the model right now) and the main value
of the infix needs to be a string. If that makes sense to you you can try
to fix it, or I can eventually.
We're close to releasing v0.9.8, I just want to make sure there are no
outstanding bugs.
…On Wed, Mar 12, 2025, 11:09 AM Henrik Ahlgren ***@***.***> wrote:
I agree it feels like a hack, OTOH not sure how it could break even more,
since I don't think the actual semantics completing-read would change in
Emacs. Perhaps it would be good idea to store the provider as a string but
it's bit complicated right now.
Transient closed magit/transient#172
<magit/transient#172> without fixing
transient.el.
Do you agree with the second fix? Now if the user does C-u M-x gptel-send
RET -m RET, it causes the error "transient-setup: Wrong type argument:
gptel-backend, nil" and there is no second chance to change the model using
the transient menu. Not very likely scenario, but perhaps the user looks
what available by hitting TAB and then decides that she is okay with the
currently selected model after all, and assumes hitting RET to an empty
prompt will just get her back to the menu without changing anything. That
actually happened to me once, that's how I noticed this problem.
—
Reply to this email directly, view it on GitHub
<#695 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACBVOLHBAQ4OZ7GY2422AB32UBZ45AVCNFSM6AAAAABY3ICFL6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJYG4YDOOJVGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
[image: pabl0]*pabl0* left a comment (karthink/gptel#695)
<#695 (comment)>
I agree it feels like a hack, OTOH not sure how it could break even more,
since I don't think the actual semantics completing-read would change in
Emacs. Perhaps it would be good idea to store the provider as a string but
it's bit complicated right now.
Transient closed magit/transient#172
<magit/transient#172> without fixing
transient.el.
Do you agree with the second fix? Now if the user does C-u M-x gptel-send
RET -m RET, it causes the error "transient-setup: Wrong type argument:
gptel-backend, nil" and there is no second chance to change the model using
the transient menu. Not very likely scenario, but perhaps the user looks
what available by hitting TAB and then decides that she is okay with the
currently selected model after all, and assumes hitting RET to an empty
prompt will just get her back to the menu without changing anything. That
actually happened to me once, that's how I noticed this problem.
—
Reply to this email directly, view it on GitHub
<#695 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACBVOLHBAQ4OZ7GY2422AB32UBZ45AVCNFSM6AAAAABY3ICFL6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJYG4YDOOJVGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I fixed the main issue at the source just now. Please test. The commit message explains the fix. Let's leave this PR open to fix the completing-read default value problem. |
Okay this kinda works, but if you don't pass the history argument to |
* gptel-transient.el (gptel--infix-provider): Use `completing-read' with a default value (current model). Prevents `gptel-backend' from being nil when the user presses RET on an empty prompt.
Even if we did pass a history variable, I don't think it would work, would it? What's being stored is in the history file is not what we read from I can merge this for now and add a TODO, but first could you verify that the correct buffer-local value of the backend and model are being set if you press |
Yeah, perhaps not worth the effort, at least as a v0.9.8 goal Though I can imagine history being somewhat useful when switching between couple of models.
Yes, if I understand this right, it restores the same model that is displayed in in the transient as the current model, even if I switch between buffers with different buffer-scope models. I was thinking if it should reset it to the standard or customized value of Anyway, I doubt this is a very common use case, it is just a way of making sure the user won't end up in a state where the transient no longer can be accessed without manually changing the variable or restarting Emacs. |
Sounds good, I can circle back to improving the I'm going to fix the send-region + gptel-org bug next and publish 0.9.8. |
Attempt to fix #693.
Furthermore, add a default value to the reader to prevent
gptel-backend
from beingnil
when the user presses RET on an empty prompt.