Closed aburlot closed 5 months ago
On Thu, Jan 18, 2024, 10:06 AM Alan @.***> wrote:
I would like to automatically run fill-paragraph or fill-region on the inserted answer in my org buffer. I think it should be done after (pulse-momentary-highlight-region p (point)) in gptel--insert-response. The post response hook seems to be a bit far to do it.
Nothing happens between the pulsing and the post response hook execution. Why do you believe it's too late?
(Also, are you using streaming responses? The hook will work either way but the behavior might be subtly different)
Any idea how I could do this properly? I'm not very fluent in elisp, so I'm not sure how to do it.
I'd add a function to gptel-post-response-functions, which see. There's an example in the wiki (link in the header on this page).
BTW, many thanks for this awesome package. I really love it!
Cheers, glad it's useful!
Dunno if this is what you're looking for:
(add-hook 'gptel-post-response-functions #'fill-region)
Perfect! I added (gptel-post-response . fill-region)
to use-package. That was simpler than I thought... Should have tried it before bothering you. Anyway, thank you for your help!
I would like to automatically run
fill-paragraph
orfill-region
on the inserted answer in my org buffer. I think it should be done after(pulse-momentary-highlight-region p (point))
ingptel--insert-response
. The post response hook seems to be a bit far to do it. Any idea how I could do this properly? I'm not very fluent in elisp, so I'm not sure how to do it.BTW, many thanks for this awesome package. I really love it!