sagemath / sage-shell-mode

Emacs front end for SageMath
GNU General Public License v3.0
98 stars 16 forks source link

Problem with "cursor position requests" #48

Open jlesieutre opened 4 years ago

jlesieutre commented 4 years ago

Since the update to Sagemath 9.0, I am no longer able to use sage-shell-mode. After starting Sage in a buffer, when I send text via C-c C-r, it gives the warning WARNING: your terminal doesn't support cursor position requests (CPR). This happens no matter what terminal software I use: urxvt, xterm, gnome-terminal, or just the emacs gui.

When I run quit in the sage buffer (sage itself runs normally), it closes and then shows some messages that I haven't seen before:

Exiting Sage (CPU time 0m0.44s, Wall time 1m15.01s).
Task was destroyed but it is pending!
task: <Task pending name='Task-251' coro=<Renderer.wait_for_cpr_responses.<locals>.wait_for_responses() running at /usr/lib/python3.8/site-packages/prompt_toolkit/renderer.py:502> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f9f22618a60>()]>>           
Task was destroyed but it is pending!
task: <Task pending name='Task-384' coro=<Renderer.wait_for_cpr_responses.<locals>.wait_for_responses() running at /usr/lib/python3.8/site-packages/prompt_toolkit/renderer.py:502> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f9f226e88e0>()]>>  

Process Sage finished

I am using Sage, emacs, ... as distributed by Arch Linux. The problem persists even when I start without a .emacs file:

vale981 commented 4 years ago

same for me Sage uses an Ipython shell now. That doesn't seem to play nicely with emacs.

jlesieutre commented 4 years ago

I have been able to run sage-shell-mode with sagemath 9.0 using the official binary under Ubuntu 18.04 (in a virtual machine) This is with the same .emacs and sage-shell-mode installed from MELPA either way. The main difference I see is that on Ubuntu I'm running emacs 25.2.2, whereas on Arch it's emacs 26.3. I don't know what other differences there might be between the default configurations.

Sakul7 commented 4 years ago

I've been having a similar problem with Manjaro and sagemath 9.0. I also get the warning WARNING: your terminal doesn't support cursor position requests (CPR). , but for me sage doesn't work normally. The cursor is not where it's supposed to be, outputs are duplicated, and loading files with C-c C-c just gives an output of Text is read-only in the emacs mini-buffer. I tried to narrow it down and it seems to work fine with Debian (in a virtual machine) for emacs 26.1. I also tried a bunch of different Manjaro configurations as a VM, e.g., with gnome desktop or bash (instead of zsh) as the standard terminal, but the error persistently occurred on all of them. Do you have a solution or any leads? Does everything work normally under Arch (might consider switching)?

jlesieutre commented 4 years ago

No, it's still broken in Arch. I have no solution except to use it in a Debian VM.

On a recent StackExchange thread someone suggested it may be related to this issue. The solution on StackExchange didn't work for me, but you could try it.

Sakul7 commented 4 years ago

Thanks for the quick response! I also saw that thread but couldn't get it to work. Did you try building sage from source? I was wondering if it is still related to issue #7. I tried myself following the instructions and the comment by @stakemori, but couldn't get the build to work on my system (I get an error while building ecl).

jlesieutre commented 4 years ago

I didn't build from source, no -- I have never had much luck with this on Arch since there are always some dependencies in the AUR that don't have compatible versions.

Sakul7 commented 4 years ago

In case anyone is interested, after building sage from source, sage-mode finally works for me again! I suppose the problem was the incompatibility with iPython 5 (see #7) after all. The build worked on Manjaro after following the instructions for Arch in the official installation guide.

jlesieutre commented 3 years ago

In case anyone stumbles still upon this, it is the same issue as #53, caused by an iPython update. EmmanuelCharpentier gives the solution of starting Sage with "sage --simple-prompt", which works for now, and it sounds like it should run this way by default in the future.

EmmanuelCharpentier commented 3 years ago

This is issue #53 for which a PR has been proposed on Aug 25, still unreviewed on Dec 25.... In the interim, feel free t use my fork.