8000 gptel-transient: Improve directive/system message editing by pabl0 · Pull Request #616 · karthink/gptel · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

gptel-transient: Improve directive/system message editing #616

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

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

pabl0
Copy link
Contributor
@pabl0 pabl0 commented Feb 6, 2025

I find no value in activating the directive in the edit buffer as region, and it can be quite annoying.

Additionally, since the directives and system messages are primarily regular text, enabling visual-line-mode (word wrapping) seems logical.

@karthink
Copy link
Owner
karthink commented Feb 6, 2025

I find no value in activating the directive in the edit buffer as region, and it can be quite annoying.

I find it quite useful. If you want to edit the existing prompt, all you need to do is press C-g. In contrast, if you want to write a custom directive and we turn off activating the region, you have to select the current prompt in this buffer first and delete it before you start typing, which is much more work. The only way to set a custom directive interactively in gptel is to use this edit buffer. Note that you can't do C-x h to mark the whole buffer (and delete text) as this selects the read-only text at the top too.

So on balance, activating the region works better.

enabling visual-line-mode (word wrapping) seems logical.

Yes, this is a good idea.

@pabl0
Copy link
Contributor Author
pabl0 commented Feb 7, 2025

I find it quite useful. If you want to edit the existing prompt, all you need to do is press C-g. In contrast, if you want to write a custom directive and we turn off activating the region, you have to select the current prompt in this buffer first and delete it before you start typing, which is much more work. The only way to set a custom directive interactively in gptel is to use this edit buffer. Note that you can't do C-x h to mark the whole buffer (and delete text) as this selects the read-only text at the top too.

Yes I think you're right, and perhaps this is the most common use case. On the other hand, when picking a crowdsourced prompt, I don't think the user would want to delete everything to edit the prompt. Perhaps we could make setting the region optional depending on a parameter, and call it differently from gptel--read-crowdsourced-prompt?

karthink added a commit that referenced this pull request Feb 7, 2025
* gptel-transient.el (gptel--read-crowdsourced-prompt): Deactivate
the mark after entering the prompt-edit buffer for a crowdsourced
prompt (#616).  The reasoning is that the user will almost
certainly want to edit the chosen prompt, and not overwrite/clear
it.

Also set the crowdsourced prompt according to the current scope.
@karthink
Copy link
Owner
karthink commented Feb 7, 2025 via email

* gptel-transient.el (gptel--edit-directive): Enable visual-line-mode.
@karthink karthink merged commit 7ff67c1 into karthink:master Feb 7, 2025
@karthink
Copy link
Owner
karthink commented Feb 7, 2025

Cheers @pabl0!

pabl0 added a commit to pabl0/gptel that referenced this pull request Feb 7, 2025
* gptel-transient.el (gptel--read-crowdsourced-prompt,
gptel--edit-directive, gptel--suffix-system-message): Deactivate the
mark after entering the prompt-edit buffer for a crowdsourced
prompt (karthink#616). This behaviour was introduced in commit cc53a81, but
it did not actually work since `deactivate-mark' was called after
returning from `gptel--read-crowdsourced-prompt', when it was too
late.
pabl0 added a commit to pabl0/gptel that referenced this pull request Feb 8, 2025
* gptel-transient.el (gptel--read-crowdsourced-prompt,
gptel--edit-directive, gptel--suffix-system-message): Deactivate the
mark after entering the prompt-edit buffer for a crowdsourced
prompt (karthink#616). This behaviour was introduced in commit cc53a81, but
it did not actually work since `deactivate-mark' was called after
returning from `gptel--read-crowdsourced-prompt', when it was too
late.

* gptel-rewrite.el (gptel--suffix-rewrite-directive): Call
`gptel--rewrite-directive' with mark activation enabled.
karthink pushed a commit that referenced this pull request Feb 8, 2025
* gptel-transient.el (gptel--read-crowdsourced-prompt,
gptel--edit-directive, gptel--suffix-system-message): Deactivate the
mark after entering the prompt-edit buffer for a crowdsourced
prompt (#616). This behaviour was introduced in commit cc53a81, but
it did not actually work since `deactivate-mark' was called after
returning from `gptel--read-crowdsourced-prompt', when it was too
late.

* gptel-rewrite.el (gptel--suffix-rewrite-directive): Call
`gptel--rewrite-directive' with mark activation enabled.
marcbowes pushed a commit to marcbowes/gptel that referenced this pull request Mar 19, 2025
* gptel-transient.el (gptel--read-crowdsourced-prompt): Deactivate
the mark after entering the prompt-edit buffer for a crowdsourced
prompt (karthink#616).  The reasoning is that the user will almost
certainly want to edit the chosen prompt, and not overwrite/clear
it.

Also set the crowdsourced prompt according to the current scope.
marcbowes pushed a commit to marcbowes/gptel that referenced this pull request Mar 19, 2025
* gptel-transient.el (gptel--edit-directive): Enable visual-line-mode.
marcbowes pushed a commit to marcbowes/gptel that referenced this pull request Mar 19, 2025
)

* gptel-transient.el (gptel--read-crowdsourced-prompt,
gptel--edit-directive, gptel--suffix-system-message): Deactivate the
mark after entering the prompt-edit buffer for a crowdsourced
prompt (karthink#616). This behaviour was introduced in commit cc53a81, but
it did not actually work since `deactivate-mark' was called after
returning from `gptel--read-crowdsourced-prompt', when it was too
late.

* gptel-rewrite.el (gptel--suffix-rewrite-directive): Call
`gptel--rewrite-directive' with mark activation enabled.
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

Successfully merging this pull request may close these issues.

2 participants
0