branch: elpa/gptel
commit ffea59c2931315cb4db551789092d11440746ab2
Author: Karthik Chikmagalur <[email protected]>
Commit: Karthik Chikmagalur <[email protected]>

    gptel-context: Fix overlay handling in gptel-context-remove-all
    
    * gptel-context.el (gptel-context-remove-all): After the
    `gptel-context' spec change, buffer regions in the context are
    specified in a plist with the :overlays key and not a list of
    overlays.  Update `gptel-context-remove-all' to handle
    this. (#1142)
---
 gptel-context.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gptel-context.el b/gptel-context.el
index bfd4602bb42..d06f4741545 100644
--- a/gptel-context.el
+++ b/gptel-context.el
@@ -335,9 +335,9 @@ afterwards."
     (when (or (not verbose) (y-or-n-p "Remove all context? "))
       (cl-loop
        for context in gptel-context
-       for (source . ovs) = (ensure-list context)
-       if (cl-every #'overlayp ovs) do           ;Buffers and buffer regions
-       (mapc #'gptel-context-remove ovs)
+       for (source . spec) = (ensure-list context)
+       if (bufferp source) do           ;Buffers and buffer regions
+       (mapc #'gptel-context-remove (plist-get spec :overlays))
        else do (gptel-context-remove source) ;files or other types
        finally do (setq gptel-context nil)))
     (when verbose (message "Removed all gptel context sources."))))

Reply via email to