gptel-curl: Run post-response-hook in gptel buffer

* gptel-curl.el (gptel-curl--stream-cleanup): `gptel-post-response-hook' should
run in the buffer that was current when the request was sent.  This was not the
case for the curl method (with response streaming).  Fixed.
This commit is contained in:
Karthik Chikmagalur 2023-05-03 13:47:15 -07:00
parent ac754ceb2a
commit 422eba8048

View file

@ -145,8 +145,9 @@ PROCESS and STATUS are process parameters."
(with-current-buffer gptel-buffer
(when gptel-mode
(gptel--update-header-line
(format " Response Error: %s" http-msg) 'error)))))
(run-hooks 'gptel-post-response-hook)
(format " Response Error: %s" http-msg) 'error))))
(with-current-buffer gptel-buffer
(run-hooks 'gptel-post-response-hook)))
(setf (alist-get process gptel-curl--process-alist nil 'remove) nil)
(kill-buffer proc-buf)))