From a0dd0346a2bcd4a21b3d119680b4173a1e19022b Mon Sep 17 00:00:00 2001 From: Bram Schoenmakers Date: Sun, 21 Jan 2024 11:09:25 +0100 Subject: [PATCH] Do not attempt to insert in read-only buffers --- kagi.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kagi.el b/kagi.el index 414614e..d44c662 100644 --- a/kagi.el +++ b/kagi.el @@ -394,7 +394,7 @@ If INSERT is non-nil, the response is inserted at point. Otherwise, show the result in a separate buffer." (interactive "sfastgpt> \nP") (let ((result (kagi-fastgpt prompt))) - (if insert + (if (and insert (not buffer-read-only)) (save-excursion (insert result)) (kagi--fastgpt-display-result result))))