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
The shell buffer and "elpy-shell-toggle-dedicated-shell" #1328
Comments
Thank you for this well detailed report ! I was able to reproduce the bug. Could you check that your problem is effectively linked to this ? (defun python-shell-get-process-name (dedicated)
"Calculate the appropriate process name for inferior Python process.
If DEDICATED is t returns a string with the form
`python-shell-buffer-name'[`buffer-name'] else returns the value
of `python-shell-buffer-name'."
python-shell-buffer-name) If it does fix the problem, I will try to think about a more elegant way of fixing this. |
Apologies for the slow response. I started out by trying to reproduce my reported bug, but it seems to be fixed - was your siggestion above already made changes within elpy in the latest update? I had updated all packages before starting, but hadn't redefined the function as you suggested. The definition of
Do you know if this has been changed recently? |
I still have the issue. It's due to the fact that python.el always send the code to a dedicated shell if it exists. So if you try to send the code to the global shell while a dedicated shell exists, the code will always be sent to the dedicated shell. Steps to reproduce:
@nicholas-mitchell Do you still have the issue in this situation ? Solution ?First solutionIt is possible to fix this by overwriting Second solutionKill dedicated shells when switching to a global shell, to be sure to avoid the aforementioned situation. I will try to find a better solution, or implement the second one I thing. |
The name of the dedicated python shells are now using the buffer name without extension. This avoid conflicts with the way python.el handles dedicated shells (see jorgenschaefer#1328).
The name of the dedicated python shells are now using the buffer name without extension. This avoid conflicts with the way python.el handles dedicated shells (see jorgenschaefer#1328).
I just tried again and am able to reproduce the error. Not sure what I had done differently to report that things were working as desired! It was on a different computer, but with a cloned Emacs setup, both on Linux. Just a quick FYI (in case it makes a difference somehow): I use the command Would it be possible to store a buffer-specific variable that just tracks the target shell for sending commands? Toggling using Once last thing I will mention, I remember using this feature within Emacs using ESS mode macs Speaks Statistics, I believe - and for R instead of Python), which worked very well. It may be worth looking into their implementation for tips. |
Finally, I tried a third solution. If it appears that it's not a viable solution, I will try to see if yours can be implemented. |
Apologies for the slow testing on my part. Everything now works just fine for me using your changes made in PR #1353 👍 Thanks again @galaunay |
Good news then ! Thank for the feedback. |
Thank you for this package, specifically for a recent enhancement in the latest update; namely the ability to set a buffer to run into a specific shell. Here is the related enhancement issue - [#1232] .
I am having a few problems with this feature. I can assign buffers their own shells and send code to them as one would expect - works great!
The scenario:
If I use the function
elpy-shell-toggle-dedicated-shell
and select a different shell, there is no error or warning, however things don't work as expected. If I send a line of code from the buffer to the newly assigned shell, the literal line of code does appear in the new shell, however it is actually executed in the original shell.The iPython interpreter of the original shell does update (the
In [n]
is incremented toIn [n+1], but there is otherwise no text shown
), whereas the newly assigned shell just gets the raw text and the interpreter seems to hang, e.g.:... this only updates to have
In [7]
if I go into the shell and hit Enter.The values e.g.
test_loss = -np.inf
are not defined in that shell, i.e. they didn't run.If I assign the buffer back to the original shell, things carry on working as expected. this behaviour occurs if I use either of the new functions to swap the shell assignment, i.e.
elpy-shell-toggle-dedicated-shell
orelpy-shell-set-local-shell
.Could this be linked to the way the iPython interpreter works within Emacs?
My setup:
pyvenv-workon
elpy-config
output:@galaunay - as you implemented this, any ideas what I might be doing wrong?
I'm happy to provide any further information :)
The text was updated successfully, but these errors were encountered: