Open steve-the-bayesian opened 5 years ago
That is indeed an unexpected behavior.
I didn't manage to reproduce the issue using exit()
to kill the python process.
Is it the way you are killing it ?
Could you also try without shell echoing ((setq elpy-shell-echo-input nil elpy-shell-echo-output nil)
), just to check if it could be coming from there ?
I kill the process by pressing Ctrl-D.
If I follow the procedure listed in the bug report, with shell echoing turned off, then focus stays in the script. Removing shell echoing seems to have solved the problem. Thanks!
On Wed, Oct 9, 2019 at 2:40 AM galaunay notifications@github.com wrote:
That is indeed an unexpected behavior.
I didn't manage to reproduce the issue using exit() to kill the python process. Is it the way you are killing it ?
Could you also try without shell echoing ((setq elpy-shell-echo-input nil elpy-shell-echo-output nil)), just to check if it could be coming from there ?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jorgenschaefer/elpy/issues/1687?email_source=notifications&email_token=ABMVDVKFWKQ4S2YLHGQ4F5TQNWRHXA5CNFSM4I6VQXG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAXJLSA#issuecomment-539923912, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMVDVP243WHHQ6OFOBFRUDQNWRHXANCNFSM4I6VQXGQ .
Glad to know it works.
It is still an unexpected behavior, would you accept to give me some more information, so I can try to fix the problem for good ?
Notably, It would be nice to know which of the two options (elpy-shell-echo-input
or elpy-shell-echo-output
) is creating the problem.
Could you also try the same procedure you listed earlier, but running (setq elpy-shell--captured-output nil)
just after killing the shell with Ctrl-D
?
Interestingly, I'm having trouble getting BACK to a state where the problem surfaces. I have lived with this behavior for over a year and am glad to be rid of it. If I'm able to recreate the setting where I experience this issue I will run the requested experiment. Whether or not that actually happens thanks for your help.
On Thu, Oct 10, 2019 at 5:14 AM galaunay notifications@github.com wrote:
Glad to know it works.
It is still an unexpected behavior, would you accept to give me some more information, so I can try to fix the problem for good ?
Notably, It would be nice to know which of the two options ( elpy-shell-echo-input or elpy-shell-echo-output) is creating the problem.
Could you also try the same procedure you listed earlier, but running (setq elpy-shell--captured-output nil) just after killing the shell with Ctrl-D ?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jorgenschaefer/elpy/issues/1687?email_source=notifications&email_token=ABMVDVOWIGIG3I4ESIMVUWLQN4MEHA5CNFSM4I6VQXG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEA4AWZY#issuecomment-540543847, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMVDVJE32GCXSRWD72PZX3QN4MEHANCNFSM4I6VQXGQ .
It happened again.
While experiencing the undesired switching behavior, I executed the command (setq elpy-shell--captured-output nil)
I'm still getting sent to the python buffer each time I press C-Return to execute a python command. Executing (setq elpy-shell-echo-input nil elpy-shell-echo-output nil) does not get me out of it, so maybe my previous message was a false diagnosis.
I tried running several versions of the first command, in case your message had a typo: (setq elpy-shell--captured-output nil) (setq elpy-shell-captured-output nil) ;; No double -- (setq elpy-shell-capture-output nil)
On Thu, Oct 10, 2019 at 8:20 AM Steven Scott steve.the.bayesian@gmail.com wrote:
Interestingly, I'm having trouble getting BACK to a state where the problem surfaces. I have lived with this behavior for over a year and am glad to be rid of it. If I'm able to recreate the setting where I experience this issue I will run the requested experiment. Whether or not that actually happens thanks for your help.
On Thu, Oct 10, 2019 at 5:14 AM galaunay notifications@github.com wrote:
Glad to know it works.
It is still an unexpected behavior, would you accept to give me some more information, so I can try to fix the problem for good ?
Notably, It would be nice to know which of the two options ( elpy-shell-echo-input or elpy-shell-echo-output) is creating the problem.
Could you also try the same procedure you listed earlier, but running (setq elpy-shell--captured-output nil) just after killing the shell with Ctrl-D ?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jorgenschaefer/elpy/issues/1687?email_source=notifications&email_token=ABMVDVOWIGIG3I4ESIMVUWLQN4MEHA5CNFSM4I6VQXG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEA4AWZY#issuecomment-540543847, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMVDVJE32GCXSRWD72PZX3QN4MEHANCNFSM4I6VQXGQ .
I reviewed the function bound to C-RET
but I fail to understand what happens.
Could you try running those statements in place of hitting C-RET
:
(python-shell-send-string "print('OK')")
(elpy-shell--append-to-shell-output "\n")
(elpy-shell--ensure-shell-running)
(elpy-shell--with-maybe-echo (python-shell-send-string "print('OK')"))
and check if one of them it triggering the faulty behaviour ? It will help narrowing down where the issue lies.
ps: as a temporary workaround, this may work:
(define-key elpy-mode-map (kbd "<C-return>")
(lambda ()
(interactive)
(save-excursion (elpy-shell-send-statement-and-step))))
Summary
When I try to step through a python script, I often enter a state where C-Return switches focus to the python buffer. This obviously makes it hard to do the stepping, because I need to switch back to the script after every statement.
Steps to reproduce
1) Open a python script (.py file). 2) C-c C-z to start a python process. 3) Repeatedly press C-Return to step through the python script. 4) Kill the python process in the python buffer, but leave the buffer open 5) From the python script buffer, press C-c C-z again to relaunch python. 6) Press C-Return (or directly enter the command elpy-shell-send-statement-and-step)
Focus changes to the python buffer, making it hard to step through the program. I only see this behavior when restarting python in a previous python buffer. I have gotten into the habit of killing the buffer and starting over from scratch, but that obliterates the command history, which would be useful to keep around.
My configuration
OS
MacOS Mojave 10.14.6
Result of
(elpy-config)
Elpy configuration in my init.el