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

    gptel: Check include-tool-results in request buffer
    
    * gptel.el (gptel--display-tool-results): When adding tool call
    results to a buffer, check the value of
    `gptel-include-tool-results' in the request buffer, and not the
    buffer current at this time.  This respects the buffer-local value
    of `gptel-include-tool-results'.
---
 gptel.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gptel.el b/gptel.el
index bb0b87221fc..da22217f7a2 100644
--- a/gptel.el
+++ b/gptel.el
@@ -1802,8 +1802,8 @@ for tool call results.  INFO contains the state of the 
request."
          (tool-marker (plist-get info :tool-marker))
          (tracking-marker (plist-get info :tracking-marker)))
     ;; Insert tool results
-    (when gptel-include-tool-results
-      (with-current-buffer (marker-buffer start-marker)
+    (with-current-buffer (marker-buffer start-marker)
+      (when gptel-include-tool-results
         (cl-loop
          for (tool args result) in tool-results
          with include-names =
@@ -1867,9 +1867,9 @@ for tool call results.  INFO contains the state of the 
request."
          (unless tracking-marker
            (setq tracking-marker (plist-get info :tracking-marker)))
          (if tool-marker
-               (move-marker tool-marker tracking-marker)
-             (setq tool-marker (copy-marker tracking-marker nil))
-             (plist-put info :tool-marker tool-marker))
+             (move-marker tool-marker tracking-marker)
+           (setq tool-marker (copy-marker tracking-marker nil))
+           (plist-put info :tool-marker tool-marker))
          (ignore-errors                 ;fold drawer
            (save-excursion
              (goto-char tracking-marker)

Reply via email to