-
Notifications
You must be signed in to change notification settings - Fork 190
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: Use width of the full frame instead of window #630
base: master
Are you sure you want to change the base?
Conversation
A-ha, apologies for not checking closed PRs for such an obvious improvement idea. Would it be too hacky approach if ;; the current default value not likely changing often?
(equal transient-display-buffer-action
'(display-buffer-in-side-wi ndow
(side . bottom)
(dedicated . t)
(inhibit-same-window . t))) Just thinking that most likely folks annoyed by this truncating behavior outnumber the ones who want to customize the variable. |
Yup, I think that's too hacky. Technically you want (equal transient-display-buffer-action
(apply #'eval (get 'transient-display-buffer-action 'standard-value))) but this is the kind of "fix" that feels mighty clever in the present, and leaves you scratching your head and cursing yourself in the future. So I want to avoid it. This can also break in many ways, such as with a display buffer action that still uses the full frame but differs from the default. The correct solution is to find a way to get the width of the transient window before truncating the system message. I haven't had the time or inclination to investigate this in |
Isn't` this just a fancy way of saying (default-value 'transient-display-buffer-action) But what if tarsius decides to change it in some subtle way.. so that
Well, then
Challenge accepted. But oh boy |
No, these are completely different things.
See
👍 I've found understanding it to be straightforward, but remembering how transient works is impossible. If it's been a couple of months since i last looked at it I have to read the whole file again. |
* gptel-transient.el: (gptel-system-prompt--format, gptel--setup-directive-menu, gptel-tools): When discovering the width of the transient window, use `transient--window' as an argument. Otherwise, `window-width' will return the width of the active window where the transient was launched from, and if the frame has been split horizontally, things get truncated incorrectly. If `transient-display-buffer-action' has been set to open windows on the left or right hand side, it also works since transient always fits the window to the buffer.
Okay, I believe I finally figured it out. Of course can't promise some weird |
(Okay not quite there yet but after a good night sleep I'll get there. Turns out the horizontal use case is more tricky + need to check for window-live-p) |
Things I've learned so far trying to get this working:
So, I can get the normal case with transient in the bottom working correctly each time, but it is already in current state broken when the transient is displayed in the right/left (well actually tested just right but assuming the problem is symmetrical). Perhaps we could just hardcode the width of the system message etc to be the same as the transient menu items when transient menu is on the side? Please note that this is already broken as is. EDIT: Testing on Emacs 28.2 and 29.4 with transient 0.8.4. Perhaps the transient version in MELPA has improved, but presumably we're not going to rely on bleeding edge MELPA version. |
frame-width' instead of
window-width' when truncating things when using the minibuffer. Otherwise they get truncated too early when the user has horizontally split windows.