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

[Feature Request] Eshell Extensions #222

Open
gopar opened this issue Aug 4, 2024 · 5 comments
Open

[Feature Request] Eshell Extensions #222

gopar opened this issue Aug 4, 2024 · 5 comments

Comments

@gopar
Copy link

gopar commented Aug 4, 2024

Hey, thanks again for the package.

I've been playing with the eshell integration (didn't know there was one until recently!) and so far has been good. Which got me wondering if it would be a good idea (perhaps?) to have a eshell/?/ or maybe just eshell/chat to be able to ask chatgpt questions directly in eshell?

And once chatgpt answers, there could be a button (or keybinding) that jumps to the chatgpt buffer to continue the convo with the context still there.

~$ for file in *.py; echo $file; end
error

~$ ?/ how do I loop over all python files in a directory?

<chatgpt response>
---
<button to jump to chatgpt shell to continue conversation>

~$

Not sure how beneficial this might be since I got the idea from Warp Terminal which the kids these days seem to be excited for (honestly the only thing that it has over emacs in general is that it integrates with AI from the beginning, but packages like this are taking car of that 😃)

@xenodium
Copy link
Owner

xenodium commented Aug 4, 2024

Hi Gopar! Thanks for filing.

The eshell ?? command was a little weird to get working with streaming (it delegates to an external Emacs process). There's likely a better way.

While ?? does get streaming, the downside is we don't have an associated chatgpt shell in the current Emacs instance (so no follow-ups).

With the current approach, it'd be straightforward to add one-off streamed chat command (but no follow-up capability) or a chat command that automatically bumps you over to a chatgpt shell. There may be other options. Maybe need to think more.

Btw, have you used the "compose interface" some more (via chatgpt-shell-prompt-compose)? I have a global binding, making querying available from anywhere. I wonder if that can be extended further to draw context from eshell. Compose buffers are backed by chatgpt shells (so you can have follow-ups).

@gopar
Copy link
Author

gopar commented Aug 5, 2024

Btw, have you used the "compose interface" some more (via chatgpt-shell-prompt-compose)?

Honestly, I keep forgetting this feature exists, I even have it bind to an easy key. I default to simply calling a chat shell.


Hmm feel free to disregard this, but wouldn't it be possible to make chatgpt-shell-prompt-compose to be "context" aware in eshell? eg, if someone calls the compose command in eshell, it can look at the last output and automatically insert it into the buffer?

No need to take action on this, after thinking a bit more, even I'm not certain how useful having AI integration in eshell would be when "compose" and the general "chat shell" are a keybind away. Perhaps I got carried away after seeing a new shiny terminal doing something

@xenodium
Copy link
Owner

xenodium commented Aug 5, 2024

wouldn't it be possible to make chatgpt-shell-prompt-compose to be "context" aware in eshell?

Yup yup. This is what I meant by I wonder if that can be extended further to draw context from eshell.

No need to take action on this, after thinking a bit more, even I'm not certain how useful having AI integration in eshell would be when "compose" and the general "chat shell" are a keybind away.

These days, my usage is primarily via compose, with the ocasional peek at the shell/history. In a similar fashion to "context aware", if you invoke compose with point on a flymake issue, the compose buffer is automatically populated with the error and additional buffer context.

I'll have a look at adding eshell context to compose buffer.

@xenodium
Copy link
Owner

xenodium commented Aug 5, 2024

I've pushed 4263fb2 so last eshell command is automatically added to the compose buffer. Active region takes precedence over last command.

See how well that works for ya. I'm thinking we may want to make it a tiny bit smarter so it includes the command/output at point if point is not at the end of buffer.

@gopar
Copy link
Author

gopar commented Aug 6, 2024

I've pushed 4263fb2 so last eshell command is automatically added to the compose buffer. Active region takes precedence over last command.

Nice! I'm playing around with it. Seems to be working fine! :)

I'm thinking we may want to make it a tiny bit smarter so it includes the command/output at point if point is not at the end of buffer.

I like that idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants