gptel-curl: Only convert to Org in Org buffers

* gptel-curl.el (gptel-curl-get-response): Don't convert response
into org-mode unless the buffer from which the request originated
is in org-mode.  This makes `gptel-default-mode' less binding, and
only used when creating a new chat session with `gptel'.  Also,
gptel should now do the right thing depending on whether the
current buffer is in text, Markdown or Org modes.
This commit is contained in:
Karthik Chikmagalur 2023-07-21 13:32:07 -07:00
parent a660e13a8b
commit c20fba8247

View file

@ -90,11 +90,10 @@ the response is inserted into the current buffer after point."
(if gptel-stream
#'gptel-curl--stream-insert-response
#'gptel--insert-response))
:transformer (when (or (eq gptel-default-mode 'org-mode)
(eq (buffer-local-value
:transformer (when (eq (buffer-local-value
'major-mode
(plist-get info :buffer))
'org-mode))
'org-mode)
(gptel--stream-convert-markdown->org)))
info))
(if gptel-stream