emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ellama 8131113c4c 3/5: Manually save the point instead


From: ELPA Syncer
Subject: [elpa] externals/ellama 8131113c4c 3/5: Manually save the point instead of calling save-excursion
Date: Sat, 23 Dec 2023 12:58:05 -0500 (EST)

branch: externals/ellama
commit 8131113c4c7aa5c8aea07a51cc699aac1417ca06
Author: Steven Allen <steven@stebalien.com>
Commit: Steven Allen <steven@stebalien.com>

    Manually save the point instead of calling save-excursion
---
 ellama.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ellama.el b/ellama.el
index 833d18e55b..18fa043103 100644
--- a/ellama.el
+++ b/ellama.el
@@ -212,11 +212,14 @@ when the request completes (with BUFFER current)."
              (lambda (text)
                ;; Erase and insert the new text between the marker cons.
                (with-current-buffer buffer
-                 (save-excursion
+                 ;; Manually save/restore point as save-excursion doesn't 
restore the point into
+                 ;; the middle of replaced text.
+                 (let ((pt (point)))
                    (goto-char start)
                    (delete-region start end)
                    (insert (funcall filter text))
-                   (fill-region start (point)))
+                   (fill-region start (point))
+                   (goto-char pt))
                  (when-let ((ellama-auto-scroll)
                             (window (get-buffer-window buffer)))
                    (with-selected-window window



reply via email to

[Prev in Thread] Current Thread [Next in Thread]