karthink / gptel

A simple LLM client for Emacs
GNU General Public License v3.0
1.04k stars 113 forks source link

Setting custom directives erroneously inserts text from original buffer. #138

Closed blacklandco closed 7 months ago

blacklandco commented 7 months ago

Thanks for this package! Been putting it to good use already, but I'm seeing some very weird behavior when trying to set custom directives . After editing the directive, seemingly random text replaces the directive that was entered into the gptel-system window.

Additionally, the focus gets trapped in the transient window when trying to set the custom directive, so you have to C-g before you can edit the directive.

Emacs version 29.0.60

GPTel Version: 20231113.211 installed from melpa Commit: 17a58d38e7299f254d02c29bbcc9211146394758

Transient Version: 20231112.923 from melpa Commit: 3cd1de1695084df089cc90cff89b32dfd6ca5a0a

Steps to reproduce:

  1. Select text in buffer
  2. Run M-x gptel-menu
  3. Press h to set directives
  4. Press h again to Set custom directives
  5. *gptel-system* buffer opens, but focus is stuck in the transient window. Only recourse is to C-g to close the transient window.
  6. After closing transient window, *gptel-system* window is usable
  7. Edit the system prompt and C-c to finish editing the prompt. (Would be great if there was a way to abort btw)
  8. The new Directive displayed in the transient window consists of text from the original buffer but several lines above the text that was originally selected. The text inputted as the new system prompt is not included.
karthink commented 7 months ago

Thanks for catching this, should be fixed in de6d808.

(Would be great if there was a way to abort btw)

Added, see the new hint in the custom directive buffer.