Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make markdown to org conversion optional #341

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions gptel-curl.el
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ REQUEST-DATA is the data to send, TOKEN is a unique identifier."
collect (format "-H%s: %s" key val))
(list url))))

(defcustom gptel-curl-convert-markdown-to-org nil
"Whether to convert Markdown to Org in GPTel curl responses."
:type 'boolean)

;;TODO: The :transformer argument here is an alternate implementation of
;;`gptel-response-filter-functions'. The two need to be unified.
;;;###autoload
Expand Down Expand Up @@ -135,8 +139,10 @@ the response is inserted into the current buffer after point."
(if stream
#'gptel-curl--stream-insert-response
#'gptel--insert-response))
:transformer (when (with-current-buffer (plist-get info :buffer)
(derived-mode-p 'org-mode))
:transformer (when (and
(with-current-buffer (plist-get info :buffer)
(derived-mode-p 'org-mode))
gptel-curl-convert-markdown-to-org)
(gptel--stream-convert-markdown->org)))
info))
(if stream
Expand Down