Skip to content

Commit 76a0c16

Browse files
committed
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))
1 parent 33ee023 commit 76a0c16

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

gptel-org.el

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,10 @@ depend on the value of `gptel-org-branching-context', which see."
247247
(goto-char (point-max))
248248
(gptel-org--unescape-tool-results)
249249
(gptel-org--strip-block-headers)
250-
(when gptel-org-ignore-elements (gptel-org--strip-elements))
250+
(when-let* ((gptel-org-ignore-elements ;not copied by -with-buffer-copy
251+
(buffer-local-value 'gptel-org-ignore-elements
252+
org-buf)))
253+
(gptel-org--strip-elements))
251254
(setq org-complex-heading-regexp ;For org-element-context to run
252255
(buffer-local-value 'org-complex-heading-regexp org-buf))
253256
(current-buffer))))
@@ -257,7 +260,10 @@ depend on the value of `gptel-org-branching-context', which see."
257260
(gptel--with-buffer-copy org-buf beg prompt-end
258261
(gptel-org--unescape-tool-results)
259262
(gptel-org--strip-block-headers)
260-
(when gptel-org-ignore-elements (gptel-org--strip-elements))
263+
(when-let* ((gptel-org-ignore-elements ;not copied by -with-buffer-copy
264+
(buffer-local-value 'gptel-org-ignore-elements
265+
org-buf)))
266+
(gptel-org--strip-elements))
261267
(setq org-complex-heading-regexp ;For org-element-context to run
262268
(buffer-local-value 'org-complex-heading-regexp org-buf))
263269
(current-buffer))))))

0 commit comments

Comments
 (0)