branch: elpa/gptel commit bbc6ec2ffd0cf2e901a83625f69191fe91c76a06 Author: Henrik Ahlgren <pa...@seestieto.com> Commit: GitHub <nore...@github.com>
gptel-rewrite: Ensure kill-buffer does not ask for confirmation (#733) message.el assigns values to `buffer-file-name' and `buffer-auto-save-file-name' upon entering `message-mode', which triggers the `gptel-rewrite' command launched from a Message buffer to prompt the user for confirmation when killing the temporary buffer with unsaved changes. Other major modes may exhibit similar behavior as well. (#730) * gptel-rewrite.el (gptel--rewrite-callback): Make the temporary buffer " *gptel-rewrite*" not have an associated buffer file name or auto save file name to avoid this issue. --- gptel-rewrite.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gptel-rewrite.el b/gptel-rewrite.el index 05d77b91a6..f0affe66af 100644 --- a/gptel-rewrite.el +++ b/gptel-rewrite.el @@ -397,6 +397,8 @@ INFO is the async communication channel for the rewrite request." (when (eq (char-before (point-max)) ?\n) (plist-put info :newline t)) (delay-mode-hooks (funcall (buffer-local-value 'major-mode buf))) + ;; message.el and possily others set these when entering the major mode. (#730) + (setq buffer-file-name nil buffer-auto-save-file-name nil) (add-text-properties (point-min) (point-max) '(face shadow font-lock-face shadow)) (goto-char (point-min))) (insert response)