kaz-yos / eval-in-repl

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

First commands not send to shell (windows) #21

Open theldoria opened 7 years ago

theldoria commented 7 years ago

The first command (or region) I send using eir-eval-in-shell (or eir-eval-in-shell2) is not executed. Afterwards, while the buffer *shell* exists, the commands work.

Tested using windows native shell (cmd).

kaz-yos commented 7 years ago

Hi, I'm sorry for the late response.

What happens if you M-: (or M-x eval-expression) and then type in (shell) in the mini-buffer and hit RET? eval-in-repl-shell calls shell behind the scene if the *shell* buffer does not exist. Somehow that part seems to be experiencing a problem. Is it correct, the first invocation does not result in evaluation in the *shell*, but does start the *shell* buffer?

theldoria commented 7 years ago

If the shell is already open, everything is fine. Otherwise, the first eir-eval-in-shell opens the shell, without executing the command; all following invocations execute the command as expected.

naupaka commented 6 years ago

First off, thanks for this! Super helpful/useful.

Same issue happens for me. First call opens a new shell window btu does not run command from script file, all subsequent calls work as expected, once the shell window exists. Same behavior for both (eir-eval-in-shell) and (eir-eval-in-shell2).

Emacs 25.2.1 on OS X 10.13.1, eval-in-repl melpa v. 20170730.1445

naupaka commented 6 years ago

Looks like focus stays in shell window after starting, so the function to send the region or line doesn't find anything. Tried to set (setq exec-in-script t) but that didn't fix it either.

naupaka commented 6 years ago

So it looks to be a problem with it not preserving the initial window in eir-repl-start. When I change the last line of that function from (select-window window-script) to (other-window 1) then C-RET works as expected on the first time, even if the shell buffer doesn't exist yet.

naupaka commented 6 years ago

Also works fine if I comment out

(when (not exec-in-script)
  (select-window window-repl))

in eir-repl-start.

Not sure where the best place to fix this is, since I am not sure why it's not switching back to the script window at the end in the first place.