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

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

[nongnu] elpa/gptel 11612b9101: gptel-context: Fix context inspection bu


From: ELPA Syncer
Subject: [nongnu] elpa/gptel 11612b9101: gptel-context: Fix context inspection buffer issues (#482)
Date: Sun, 24 Nov 2024 15:59:57 -0500 (EST)

branch: elpa/gptel
commit 11612b9101e394fcc43542364d40c75e28132c3c
Author: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Commit: Karthik Chikmagalur <karthikchikmagalur@gmail.com>

    gptel-context: Fix context inspection buffer issues (#482)
    
    * gptel-context.el (gptel-context-confirm, gptel-context-visit):
    - Refresh the context buffer when confirming deletions.
    - Jump to files correctly when calling `gptel-context-visit'.
---
 gptel-context.el | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/gptel-context.el b/gptel-context.el
index a31c3158c9..a133dbe19c 100644
--- a/gptel-context.el
+++ b/gptel-context.el
@@ -465,11 +465,15 @@ If non-nil, indicates backward movement.")
   "Display the location of this gptel context chunk in its original buffer."
   (interactive)
   (let ((ov-here (car (overlays-at (point)))))
-    (if-let* ((orig-ov (overlay-get ov-here 'gptel-context))
-              (buf (overlay-buffer orig-ov))
+    (if-let* ((source (overlay-get ov-here 'gptel-context))
+              (buf (if (overlayp source)
+                       (overlay-buffer source)
+                     (find-file-noselect source)))
               (offset (- (point) (overlay-start ov-here))))
         (with-selected-window (display-buffer buf)
-          (goto-char (overlay-start orig-ov))
+          (goto-char (if (overlayp source)
+                         (overlay-start source)
+                       (point-min)))
           (forward-char offset)
           (recenter))
       (message "No source location for this gptel context chunk."))))
@@ -537,12 +541,16 @@ If non-nil, indicates backward movement.")
   "Confirm pending operations and return to gptel's menu."
   (interactive)
   ;; Delete all the context overlays that have been marked for deletion.
-  (mapc #'gptel-context-remove
-        (delq nil (mapcar (lambda (ov)
-                            (and
-                             (overlay-get ov 'gptel-context-deletion-mark)
-                             (overlay-get ov 'gptel-context)))
-                          (overlays-in (point-min) (point-max)))))
+  (when-let ((deletion-marks
+              (delq nil (mapcar
+                         (lambda (ov)
+                           (and
+                            (overlay-get ov 'gptel-context-deletion-mark)
+                            (overlay-get ov 'gptel-context)))
+                         (overlays-in (point-min) (point-max))))))
+    (mapc #'gptel-context-remove deletion-marks)
+    (gptel-context--collect)           ;Update contexts and revert buffer 
(#482)
+    (revert-buffer))
   (gptel-context-quit))
 
 (provide 'gptel-context)



reply via email to

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