Issue
How do I get ipython working correctly under emacs?
Following the ipython docs recommendation, I have enabled ipython:
(require 'python)
(setq python-shell-interpreter "ipython")
I get the following warning when I start the ipython server.
Python 3.7.4 (default, Jul 9 2019, 18:15:00)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.
WARNING: your terminal doesn't support cursor position requests (CPR).
The "[In]
" prompts do not print at all. And also when code is sent from another buffer (e.g. through python-shell-send-buffer
). Here is a sample screen dump (I'm guessing that the i 8 i 8
is from the prompt not being properly displayed):
WARNING: your terminal doesn't support cursor position requests (CPR).
i
8
i
8
hello world
Interactively, the "[Out]
" prompts sometimes display and sometimes not:
print('hello world')
hello world
4
Out[3]: 4
Emacs I'm running on macos:
This is GNU Emacs 26.3 (build 1, x86_64-apple-darwin14.5.0, NS appkit-1348.17 Version 10.10.5 (Build 14F2511))
of 2019-09-02
Copyright (C) 2019 Free Software Foundation, Inc.
Solution
(setq python-shell-interpreter-args "--simple-prompt -i")
ipython assumes you have a "normal" terminal, but in Emacs it runs under a "dumb" terminal. Really, ipython should be able to know this through the TERM
environment variable. Looks like there was some recent effort on this: https://github.com/prompt-toolkit/python-prompt-toolkit/issues/390. Hopefully it will Just Work in a future release.
Answered By - jpkotta
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.