branch: elpa/gptel
commit 5d811b1af832a388863fb1ac5b7cfaf8ce2b7ee5
Author: Karthik Chikmagalur <[email protected]>
Commit: Karthik Chikmagalur <[email protected]>
gptel-org: Autoload markdown->org converters
* gptel-org.el (gptel--convert-markdown->org,
gptel--stream-convert-markdown->org): Autoload the converters as
gptel-org may not be available when a request is made from Org
mode. Note that a gptel-request can be made from any gptel
extension, such as gptel-rewrite (#705), so the only options are
to (i) require gptel-org unconditionally when gptel is
loaded, (ii) load gptel-org when Org mode is loaded via
`with-eval-after-load', or (iii) autoload functions from gptel-org
that might be called when making a request from Org mode. The
first option is unnecessary because many users do not use Org
mode. the second works but it's bad form (according to
package-lint) to use `with-eval-after-load' in a package source,
and there are Org users who don't use gptel in Org mode. The last
option pollutes the autoload space but on balance it appears to be
the best of three suboptimal ones.
---
gptel-org.el | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gptel-org.el b/gptel-org.el
index e3de310073..f5f9256a02 100644
--- a/gptel-org.el
+++ b/gptel-org.el
@@ -526,6 +526,7 @@ non-nil (default), display a message afterwards."
;;; Transforming responses
+;;;###autoload
(defun gptel--convert-markdown->org (str)
"Convert string STR from markdown to org markup.
@@ -602,6 +603,7 @@ This is intended for use in the markdown to org stream
converter."
(insert (if end "#+end_src" "#+begin_src "))
(insert "="))))
+;;;###autoload
(defun gptel--stream-convert-markdown->org (start-marker)
"Return a Markdown to Org converter.