karthink / gptel

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

Problem due to transient #14

Closed minad closed 1 year ago

minad commented 1 year ago

Merging transient already wasn't ideal. I use gptel on Emacs 29 and I get the following error:

Error: void-function (transient-prefix)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode 0x1421f3accfae8684>))
  debug-early-backtrace()
  debug-early(error (void-function transient-prefix))
  transient-prefix(:command gptel-send-menu)

Couldn't you avoid relying on the newest features of transient? It would be great if this works out of the box with the transient version from Emacs 29 (or even better Emacs 28 only).

tarsius commented 1 year ago

Merging transient already wasn't ideal.

What does "merging transient" mean here?

I get the following error:

I cannot explain that. transient is being required and it has been defining that function since the first commit.

Couldn't you avoid relying on the newest features of transient?

I would strongly recommend depending on the newest version of transient, whether the package makes use of the newest feature or not. Some very important bug fixes landed fairly recently.

It would be great if this works out of the box with the transient version from Emacs 29

That is identical (modulo some strings to follow conventions) to the version in the standalone repository. Well, okay, currently it lags one insignificant commit behind (a new FAQ entry).

I intend for the next transient release to also be included in Emacs 29.

(or even better Emacs 28 only).

Transient wasn't ready to be added to Emacs at that time. I should have refused, but they wanted to use it in emoji. Once transient 0.4.0 is out, I strongly recommend every package that depends on transient, explicitly depends on that version.

(I think the error you experience has nothing to do with using "bleeding edge" transient. It's more likely that something is borked in your installation.)

tarsius commented 1 year ago

The builtin branch in my repository tracks the version that is included in Emacs' emacs-29 branch.

minad commented 1 year ago

What does "merging transient" mean here?

I meant that @karthink merged the transient branch of gptel, which requires new unreleased transient functionality. This broke my Emacs configuration, but it should be alright as soon as you release the next version of Transient.

I intend for the next transient release to also be included in Emacs 29.

That's good!

karthink commented 1 year ago

Did gptel become completely unusable, or is it only giving an error when you try to bring up the menu with a prefix arg?

Couldn't you avoid relying on the newest features of transient? It would be great if this works out of the box with the transient version from Emacs 29 (or even better Emacs 28 only).

It should work with the Transient version included with Emacs 28 -- before merging into master I removed the section of the code (dynamically generated menu options) that required the newer version of Transient. I tested it with emacs -q + package-install-file as well.

Error: void-function (transient-prefix)
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode 0x1421f3accfae8684>))
  debug-early-backtrace()
  debug-early(error (void-function transient-prefix))
  transient-prefix(:command gptel-send-menu)

This error is quite strange! I can't figure it out. Just to be sure this isn't related to how I autoload/require things, could you run load-file on gptel-transient.el in an Emacs session before using gptel?

minad commented 1 year ago

That's strange. Why did package-install install transient then as a separate package, despite Emacs 29?

karthink commented 1 year ago

The header in gptel.el is

;; Package-Requires: ((emacs "27.1") (aio "1.0") (transient "0.3.7"))

And in my Emacs 28.2, /usr/share/emacs/28.2/lisp/transient.el.gz has in its header

;; Package-Version: 0.3.7

So I'm not sure what's going on either.

karthink commented 1 year ago

Did gptel become completely unusable, or is it only giving an error when you try to bring up the menu with a prefix arg?

@minad can you confirm this? If gptel is completely unusable because of transient issues, this is a much higher priority problem and I might need to revert HEAD. If only the transient menu is broken I can wait for a few days for the next version to be released and test after that. The menu is currently an undocumented feature.

minad commented 1 year ago

It completely broke my config for a while, since somehow the package-quickstart.el started to throw errors. I reinstalled without gptel-transient.el. I can try again later.

karthink commented 1 year ago

@minad I think I fixed the transient issue in 9da22155 -- the autoload cookie was wrong. Please test when you can.

tarsius commented 1 year ago

Ah, yes, those damn autoload cookies.

minad commented 1 year ago

Thanks, it is fixed now!