kaz-yos / eval-in-repl

Consistent ESS-like eval interface for various REPLs
174 stars 27 forks source link

Feature/multiple sh sessions #37

Closed actondev closed 4 years ago

actondev commented 4 years ago

This is to be able to run shell snippets in different shells

The issue didn't exist here, but this was inspired by the usage of https://github.com/diadochos/org-babel-eval-in-repl to allow runnings sh snippets in different shells (see the relavant issue)

Would also like input if the implemantation is ok, it's my first emacs-lisp PR :) PS: thanks for this extension :)

kaz-yos commented 4 years ago

Thanks for the PR. When examining this, I realized I completely missed or forgot about another earlier PR (https://github.com/kaz-yos/eval-in-repl/pull/34) by @terlar. @terlar, does this new PR by @actonDev supersede yours?

actondev commented 4 years ago

@kaz-yos in my understanding the #34 is about supporting different kind of terminals through sh-script.el. in other words support sh, bash, zsh.

This one is to specify in which shell session/buffer to send the commands.

kaz-yos commented 4 years ago

Thanks! I'll examine both in the next couple of days.

terlar commented 4 years ago

Yeah, that is correct, I think both are useful, and it is correct understanding that mine were mostly about supporting different shells. Hopefully it could be combined, to allow both different shell types and several of the same type but different session.

Thank you, let me know if you have any questions, even it was quite a while since I wrote the code, so the details are not very fresh in my mind. I also see I changed the indentation a bit, which makes the diff a bit more verbose than necessary.

kaz-yos commented 4 years ago

I merged https://github.com/kaz-yos/eval-in-repl/pull/34 and https://github.com/kaz-yos/eval-in-repl/pull/37 locally, expecting some conflicts.

After resolving minor conflicts, I got this branch https://github.com/kaz-yos/eval-in-repl/tree/double-merge.

Does this double-merge branch work in your respective use cases, @terlar and @actonDev?

I should really be formalizing this with automated testing as I did in my more recent work (https://github.com/stan-dev/stan-mode/blob/master/stan-mode/test-stan-mode.el)...

actondev commented 4 years ago

Didn't actually try but just by seeing the code this won't do what my PR was intended to. The eir-shell-buffer-name variable is not used. The buffer name of the shell is being evaluated as (buffer-name (format "*shell [%s]*" dest-sh), so it only has to do with the type of the shell.

But I think the 2 PR's are not compatible in terms of decisions made:

So, how do we get to do both? I made a demo gif that one can actually use different shell types with only my PR. But it invovles an extra step of calling (setq explicit-shell-file-name "bash")

In the gif i use the org-mode-eval-in-repl (which has a PR https://github.com/diadochos/org-babel-eval-in-repl/pull/25 which was developed with this repo's PR in mind) The org-mode sh scripts was my main motivation for this PR

eval-in-repl

I would like to hear from @terlar about the usecase he would have in mind and if it's not achievable by what I demonstrated

kaz-yos commented 4 years ago

@actonDev, I'm impressed by your very modern-looking emacs! As I understand, @actonDev's PR will lay a foundation (also for @diadochos 's package), on which we may be able to build a wrapper to cover @terlar's use case. These are way beyond what I initially envisioned. I would appreciate your input.

terlar commented 4 years ago

I agree, I think it would work for my use-case as well, my PR was addressing being able to open a "REPL" when working with a specific shell script of various types. So for example if you are working on a bash script, open the REPL to try out a few things, and the same for ZSH, fish etc.

kaz-yos commented 4 years ago

OK. Thanks for your inputs! I'll merge this new PR in isolation and close the older one unmerged. Please let me know if problems emerge after it's on MELPA.