Skip to content
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

Make display-buffer-alist configuration customizable #188

Open
DivineDominion opened this issue Jan 13, 2024 · 6 comments
Open

Make display-buffer-alist configuration customizable #188

DivineDominion opened this issue Jan 13, 2024 · 6 comments

Comments

@DivineDominion
Copy link

Currently, the built-in display-buffer-alist settings are applied on the fly and thus put in front of the list -- so they always win:

chatgpt-shell/chatgpt-shell.el

Lines 1182 to 1188 in 39dd8e7

(add-to-list 'display-buffer-alist
(cons (regexp-quote (buffer-name buffer))
'((display-buffer-reuse-window display-buffer-in-direction)
(dedicated . t)
(reusable-frames . visible)
(direction . left)
(window-width . 0.35))))

This makes customization of e.g. the direction in which to display the buffer impossible.

WDYT about making the value a defcustom with a default of

             (cons (regexp-quote (buffer-name buffer))
                   '((display-buffer-reuse-window display-buffer-in-direction)
                     (dedicated . t)
                     (reusable-frames . visible)
                     (direction . left)
                     (window-width . 0.35)))

so users can use customize-variable for tweaks, and also nil to disable auto-setting this?

@xenodium
Copy link
Owner

WDYT about making the value a defcustom with a default of

We may have to make the defcustom accept a function, since it'd have to resolve "(regexp-quote (buffer-name buffer))" to the current buffer name. The challenge being that these buffers can change in name, specially if either chatgpt-shell-swap-model-version or chatgpt-shell-swap-system-prompt are invoked on the shell.

settings are applied on the fly and thus put in front of the list

What if we uniquely append instead? Would the user customization win?

@DivineDominion
Copy link
Author

WDYT about making the value a defcustom with a default of

We may have to make the defcustom accept a function, since it'd have to resolve "(regexp-quote (buffer-name buffer))" to the current buffer name. The challenge being that these buffers can change in name, specially if either chatgpt-shell-swap-model-version or chatgpt-shell-swap-system-prompt are invoked on the shell.

Makes sense!

For what it's worth, I believe a regexp based matcher for ^*chatgpt* prefix and compose$ suffix would be enough for the built-in setting (it applies the same settings for all model versions anyway). And if users want to customize where 3.5-turbo is displayed, adding an alist item is simple enough (plus maybe disabling the default one)

What if we uniquely append instead? Would the user customization win?

To be honest, I believe that relying on the list position is a quick fix that works in the user configuration, but should not be the default behavior of a library (if we can help it) because it's so brittle! User customizations can change the list in many ways and then we have the same problem but for different reasons

@xenodium
Copy link
Owner

To be honest, I believe that relying on the list position is a quick fix that works in the user configuration

Sounds good. Let's go for something more explicit...

For what it's worth, I believe a regexp based matcher for ^chatgpt prefix and compose$ suffix would be enough for the built-in setting (it applies the same settings for all model versions anyway). And if users want to customize where 3.5->turbo is displayed, adding an alist item is simple enough (plus maybe disabling the default one)

Eventually, I'd like to make it much easier to support other llm backends by virtue of moving logic to shell-maker. If at all possible, I'd trying to stay away from adding chatgpt-specific logic if possible.

Lemme see if I can add the function-based option to shell-maker.

@DivineDominion
Copy link
Author

This sounds like a sensible decision! Ping me if I can help in any way.

@xenodium
Copy link
Owner

xenodium commented Jan 29, 2024

Sorry for the delay.

It'll be quite some time until I rework the compose feature and move it to shell-maker, so better to remove the automatic entry in display-buffer-alist for the time being (e2073d9).

I think this should unblock ya?

@DivineDominion
Copy link
Author

Thanks! Don't worry, I'm fine in my own setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants