karthink / gptel

A simple LLM client for Emacs
GNU General Public License v3.0
1.03k stars 111 forks source link

gptel-org-branching-context requires Org 9.7 (unreleased) #294

Closed localauthor closed 1 month ago

localauthor commented 2 months ago

Hi Karthik, first, thanks for gptel. It is truly wonderful.

It seems that gptel-org-branching-context depends on the function org-element-lineage-map, which is not included in the current release of Org (9.6.27), at least as far as I can tell.

It seems that the file containing that function, org-element-ast.el, is in org's main branch, but 9.6 is not built with it. I do not know why it is excluded, at least in my case.

Might the branching-context feature be adapted (without too much trouble) for those of us on just this side of org's bleeding edge? Thanks for considering it, in any case.

karthink commented 2 months ago

Flying by the seat of my pants here -- I bundled org-element-lineage-map with gptel, to be evaluated at compile time if it's not natively available. Please let me know if it works, or if there are transitive dependencies that are also missing.

localauthor commented 2 months ago

Looks like there are quite a few other functions that would also need to be bundled:

org-element-parent org-element-begin org-element-type org-element-type-p org-element-secondary-p

Not sure if bundling all these is something you would want to do.

In the meantime, I've just defined all these in my init file and gptel-org-branching-context works great.

karthink @.***> writes:

Flying by the seat of my pants here -- I bundled org-element-lineage-map with gptel, to be evaluated at compile time if it's not natively available. Please let me know if it works, or if there are transitive dependencies that are also missing.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

karthink commented 2 months ago

Oof, my fix was shortsighted then, as I expected.

I'm not sure what I can do here. I can throw a warning when setting gptel-org-branching-context if the org version is not high enough, and disable it. But this warning will only fire if setting the variable using setopt or the customization menu, which I doubt most users are using.

localauthor commented 2 months ago
Or maybe instead of a warning when setting the variable, a warning when calling gptel-send in a context when a user might expect it to work, but they don’t have the right org version. Or even simpler (and what I would do) just a note about the org version requirement in the doc string. Dont think it’s worth much more effort than that, honestly. 

 From: karthink @.>Sent: Sunday, April 28, 2024 06:22To: karthink/gptel @.>Cc: Grant Rosson @.>; Author @.>Subject: Re: [karthink/gptel] gptel-org-branching-context requires Org 9.7 (unreleased) (Issue #294)  Oof, my fix was shortsighted then, as I expected. I'm not sure what I can do here. I can throw a warning when setting gptel-org-branching-context if the org version is not high enough, and disable it. But this warning will only fire if setting the variable using setopt or the customization menu, which I doubt most users are using.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

ultronozm commented 1 month ago

Perhaps someone would find it useful, if only temporarily, if you mentioned this package, which provides a similar feature (as a light wrapper around gptel) using released versions of org.

karthink commented 1 month ago

Thank you @ultronozm.

@localauthor I added a warning when gptel-org-branching-context is set if it can't find org-element-lineage-map. I don't check for the availability of org-element-parent and the rest, but I think anyone updating from an older Org version for this feature will update to the tip of the Org main branch so this should suffice.