[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/gptel 4593d0b475 1/5: gptel-rewrite: Handle read-only buff
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/gptel 4593d0b475 1/5: gptel-rewrite: Handle read-only buffers correctly |
Date: |
Mon, 2 Dec 2024 19:00:07 -0500 (EST) |
branch: elpa/gptel
commit 4593d0b475d26d25312732440f80a278ad560ef9
Author: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Commit: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
gptel-rewrite: Handle read-only buffers correctly
* gptel-rewrite.el (gptel--rewrite-callback): Handle read-only
buffers correctly. Since we don't modify the buffers there should
be no issue using gptel-rewrite in read-only buffers (like eww).
---
gptel-rewrite.el | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/gptel-rewrite.el b/gptel-rewrite.el
index f5e77f21f9..90facba4b8 100644
--- a/gptel-rewrite.el
+++ b/gptel-rewrite.el
@@ -370,7 +370,8 @@ INFO is the async communication channel for the rewrite
request."
(cond
((stringp response) ;partial or fully successful result
(with-current-buffer proc-buf ;auxiliary buffer, insert text here
and copy to overlay
- (let ((inhibit-modification-hooks nil))
+ (let ((inhibit-modification-hooks nil)
+ (inhibit-read-only t))
(when (= (buffer-size) 0)
(buffer-disable-undo)
(insert-buffer-substring buf (overlay-start ov) (overlay-end ov))
@@ -394,11 +395,12 @@ INFO is the async communication channel for the rewrite
request."
(t (let ((proc-buf (cdr-safe (plist-get info :context))) ;finished
successfully
(mkb (propertize "<mouse-1>" 'face 'help-key-binding)))
(with-current-buffer proc-buf
- (delete-region (point) (point-max))
- (when (and (plist-get info :newline)
- (not (eq (char-before (point-max)) ?\n)))
- (insert "\n"))
- (font-lock-ensure)
+ (let ((inhibit-read-only t))
+ (delete-region (point) (point-max))
+ (when (and (plist-get info :newline)
+ (not (eq (char-before (point-max)) ?\n)))
+ (insert "\n"))
+ (font-lock-ensure))
(overlay-put ov 'display (buffer-string))
(kill-buffer proc-buf))
(when (buffer-live-p buf)
- [nongnu] elpa/gptel updated (f90a77b711 -> 56c4acd608), ELPA Syncer, 2024/12/02
- [nongnu] elpa/gptel 56c4acd608 5/5: README: Tweaks to rewrite demos, ELPA Syncer, 2024/12/02
- [nongnu] elpa/gptel 8937142abd 2/5: gptel-rewrite: Hide overlay display when ediffing, ELPA Syncer, 2024/12/02
- [nongnu] elpa/gptel 4593d0b475 1/5: gptel-rewrite: Handle read-only buffers correctly,
ELPA Syncer <=
- [nongnu] elpa/gptel 7277c0004c 3/5: gptel: Handle aborting requests, better error handling, ELPA Syncer, 2024/12/02
- [nongnu] elpa/gptel c75af01daf 4/5: gptel-rewrite: Handle aborting requests, ELPA Syncer, 2024/12/02