branch: elpa/gptel
commit 76a0c1686192bc43e56b8f5e4be11736bb9806da
Author: Karthik Chikmagalur <karthikchikmaga...@gmail.com>
Commit: Karthik Chikmagalur <karthikchikmaga...@gmail.com>

    gptel-org: copy gptel-org-ignore-elements to prompt buffer
    
    * gptel-org.el (gptel-org--create-prompt-buffer):  Let-bind the
    request-buffer-local value of `gptel-org-ignore-elements' when
    stripping Org elements in the prompt construction buffer.  This is
    required since `gptel-org-ignore-elements' is not copied over by
    `gptel--with-buffer-copy'.
    
    To set `gptel-org-ignore-elements' buffer-locally in the first
    place, run
    
     (setq-local gptel-org-ignore-elements
                 (copy-sequence gptel-org-ignore-elements))
---
 gptel-org.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gptel-org.el b/gptel-org.el
index 19bc62e9b2..af0e442b09 100644
--- a/gptel-org.el
+++ b/gptel-org.el
@@ -247,7 +247,10 @@ depend on the value of `gptel-org-branching-context', 
which see."
               (goto-char (point-max))
               (gptel-org--unescape-tool-results)
               (gptel-org--strip-block-headers)
-              (when gptel-org-ignore-elements (gptel-org--strip-elements))
+              (when-let* ((gptel-org-ignore-elements ;not copied by 
-with-buffer-copy
+                           (buffer-local-value 'gptel-org-ignore-elements
+                                               org-buf)))
+                (gptel-org--strip-elements))
               (setq org-complex-heading-regexp ;For org-element-context to run
                     (buffer-local-value 'org-complex-heading-regexp org-buf))
               (current-buffer))))
@@ -257,7 +260,10 @@ depend on the value of `gptel-org-branching-context', 
which see."
         (gptel--with-buffer-copy org-buf beg prompt-end
           (gptel-org--unescape-tool-results)
           (gptel-org--strip-block-headers)
-          (when gptel-org-ignore-elements (gptel-org--strip-elements))
+          (when-let* ((gptel-org-ignore-elements ;not copied by 
-with-buffer-copy
+                       (buffer-local-value 'gptel-org-ignore-elements
+                                           org-buf)))
+                (gptel-org--strip-elements))
           (setq org-complex-heading-regexp ;For org-element-context to run
                 (buffer-local-value 'org-complex-heading-regexp org-buf))
           (current-buffer))))))

Reply via email to