From 422eba80488e795816b7539a05c6dc4ba102fc95 Mon Sep 17 00:00:00 2001 From: Karthik Chikmagalur Date: Wed, 3 May 2023 13:47:15 -0700 Subject: [PATCH] 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. --- gptel-curl.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gptel-curl.el b/gptel-curl.el index 98929e3..fa6f8ec 100644 --- a/gptel-curl.el +++ b/gptel-curl.el @@ -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)))