Commit graph

6 commits

Author SHA1 Message Date
Karthik Chikmagalur
4273f067e8 gptel-org: Improve stream converter
* test/gptel-org-test.el (gptel-org--test-stream-conversion): Add
a test harness to make comparing markdown to org easy.

* gptel-org.el (gptel--stream-convert-markdown->org): Handle
headings and strong chars in the converter.  Addresses #296.
2024-04-28 23:05:08 -07:00
Karthik Chikmagalur
a2b16c43b1 gptel-org: Include org-element-lineage-map with gptel (#294)
* gptel-org.el (gptel-org--element-lineage-map): Include
`org-element-lineage-map` for compatibility with older versions of Org (pre
9.7).
2024-04-25 13:58:33 -07:00
Karthik Chikmagalur
567af4d2ee gptel-org: Read config from Org properties (#141)
* gptel.el: Load gptel-org after Org is loaded.

* gptel-org.el (gptel-org--send-with-props): Advise `gptel-send`
and `gptel--suffix-send` to use gptel's local config (stored under
the current Org heading) when applicable.  Advice is a hacky way
to do it, but this is the simplest option without explicit
indirection via `derived-mode-p`-based dispatch code in many more
places in gptel.
2024-04-04 01:13:46 -07:00
Karthik Chikmagalur
f2fd2b13b0 gptel-org: Move response transform code for Org
* gptel.el (gptel--convert-markdown->org,
gptel--stream-convert-markdown->org, gptel-set-topic): Move code
for transforming responses and setting the GPTEL_TOPIC property to
gptel-org.  Add declarations for the byte-compiler.

* gptel-org.el (gptel-org-branching-context, gptel-org-set-topic,
gptel-org--restore-state, gptel--convert-markdown->org,
gptel--stream-convert-markdown->org): Add `gptel-org-set-topic` to
set the topic per heading in Org buffers.  Fix typo in
gptel-org--restore-state.  Add declarations for
the byte-compiler and page markers for the reader.
2024-04-04 01:13:46 -07:00
Karthik Chikmagalur
8dbcbbb908 gptel-org: Move session save/restore code for Org
* gptel.el (gptel--restore-backend, gptel--save-state,
gptel--restore-state): Move the Org-specific code for saving and
restoring state to gptel-org.

* gptel-org.el (gptel-org--entry-properties,
gptel-org--save-state, gptel-org--restore-state): Org-specific
code for saving and restoring state using Org properties, moved
from gptel-org.
2024-04-04 00:25:09 -07:00
Karthik Chikmagalur
2982ede17d gptel-org: Add gptel-org
* gptel.el (gptel--create-prompt): Split the Org mode logic in
`gptel--create-prompt` into gptel-org.el.

* gptel-org.el (gptel-org-branching-context,
gptel-org--create-prompt): Handle prompt creation for Org buffers
in `gptel-org--create-prompt`.  The option
`gptel-org-branching-context` limits the context in Org buffers to
the direct ancestors of the active heading.  This is useful for
conversations with branches.  gptel-org.el is intended to
eventually contain all the Org mode specific gptel code, and will
not be loaded unless gptel is called in an Org buffer.
2024-04-04 00:25:08 -07:00