Skip to content

Commit d4a057e

Browse files
committed
gptel-rewrite: Copy post-rewrite-functions to temp buffer
* gptel-rewrite.el (gptel--rewrite-callback): The buffer-local value of `gptel-post-rewrite-functions' in the rewrite buffer is not respected when the hook is called, because the hook is called in the temporary buffer where the response is being collected. Copy the buffer-local value of `gptel-post-rewrite-functions' to the temporary buffer before calling the hook in `gptel--rewrite-callback'.
1 parent 4275350 commit d4a057e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

gptel-rewrite.el

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ INFO is the async communication channel for the rewrite request."
514514
(let ((inhibit-read-only t))
515515
(delete-region (point) (point-max))
516516
;; Run post-rewrite-functions on rewritten text in its buffer
517+
(setq-local gptel-post-rewrite-functions
518+
(buffer-local-value 'gptel-post-rewrite-functions buf))
517519
(with-demoted-errors "gptel-post-rewrite-functions: %S"
518520
(run-hook-with-args 'gptel-post-rewrite-functions (point-min) (point-max)))
519521
(when (and (plist-get info :newline)

0 commit comments

Comments
 (0)