justl.el icon indicating copy to clipboard operation
justl.el copied to clipboard

Run interactive tool with readline history?

Open jscheid opened this issue 1 year ago • 2 comments

I've got a number of interactive recipes that use readline, e.g. rails console (a REPL for Ruby on Rails).

If I run this from M-x shell then I can use C-up to fetch the previous item from the history inside the REPL, but that doesn't work with eshell. Any chance you could add a way to run a recipe with shell instead of eshell?

In fact I can't see any advantages in using eshell over shell because my understanding is that eshell features are useful mainly at the top (shell) level, not inside a running process, but I could be missing something.

jscheid avatar Mar 11 '24 15:03 jscheid

but that doesn't work with eshell.

The key binding to fetch previous item from history inside eshell is M-p. And from a quick testing it does seem to work for me.

psibi avatar Mar 12 '24 04:03 psibi

Ah, I see what you mean: You want to fetch history from you existing shell. Yeah, I think that's not supported by eshell.

This is definetely a feature that would be nice to have, although I'm not sure if I would have enough time to implment it soon. I would be to happy to accept a PR.

Regarding implementation: I think giving a defcustom option with two options: eshell and shell with default being eshell - and then implementing the required shell integration would be acceptable.

psibi avatar Mar 12 '24 04:03 psibi

The recent version of justl.el support specifying vterm as an alternative shell: https://github.com/psibi/justl.el/blob/a46b95425c8f55d5ebfa674f09d606a6321e51e9/justl.el#L120

Does that solve the issue ?

psibi avatar Nov 15 '24 03:11 psibi

🙌 It does, thank you very much!!

One small nitpick: when I run an interactive recipe that way and use C-d to exit it, I land in the shell. It would be nice if instead doing that would kill the whole process. Is it possible that something like exec is missing somewhere?

jscheid avatar Nov 15 '24 08:11 jscheid

when I run an interactive recipe that way and use C-d to exit it, I land in the shell.

Unfortunately neither eshell or vterm provides an exec kind of API to do it.

psibi avatar Nov 15 '24 08:11 psibi

I've opened #65 with a fix, let me know what you think.

jscheid avatar Nov 15 '24 09:11 jscheid

Nice work! I didn't realize we had similar thing for eshell. I believe this issue can be closed then ?

psibi avatar Nov 15 '24 09:11 psibi

Thanks again!

jscheid avatar Nov 15 '24 09:11 jscheid