What did you expect to happen?
When starting an inferior iPython process buffer by +python/open-ipython-repl, it should behave the same as in IPython in a regular terminal emulator, i.e., one can code scripts or define a function in multi-line form, such as:
In [7]: for i in range(5):
...: print(i)
...:
0
1
2
3
4
or
In [8]: def print_i(n=5):
...: for i in range(n):
...: print(i)
...:
What actually happened?
NameError was raised:
In [2]: for i in range(10):
...: print(i)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-10-3b184248ad5a> in <module>
----> 1 print(i)
NameError: name 'i' is not defined
In [11]: def print_i(n=5):
...: for i in range(n):
...: print(i)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-25-3b184248ad5a> in <module>
----> 1 print(i)
NameError: name 'i' is not defined
System information:
emacs version 26.3
features XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS LIBSYSTEMD LCMS2
build Mar 26, 2020
buildopts (--build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd --with-pop=yes --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.3/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --with-mailutils --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd --with-pop=yes --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.3/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --with-mailutils --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/emacs-mEZBk7/emacs-26.3+1=. -fstack-protector-strong -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro')
windowsys x
daemonp server-running
doom version 2.0.9
build grafted, HEAD -> develop, origin/develop, origin/HEAD 00ebbaf 2020-06-25 15:27:26 -0400
dir ~/.doom.d/
system type gnu/linux
config x86_64-pc-linux-gnu
shell /usr/bin/zsh
uname Linux 5.4.0-45-generic #49-Ubuntu SMP Wed Aug 26 13:38:52 UTC 2020 x86_64
path (~/apps/conda/envs/ac/bin/ ~/apps/conda/condabin ~/.local/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /usr/lib/emacs/26.3/x86_64-linux-gnu/)
config envfile envvar-file
elc-files 0
modules (:completion company ivy :ui doom doom-dashboard doom-quit hl-todo indent-guides modeline ophints (popup +defaults) treemacs vc-gutter vi-tilde-fringe window-select workspaces :editor file-templates fold (format +onsave) snippets word-wrap :emacs dired electric undo vc :term eshell term vterm :checkers syntax spell grammar :tools debugger (eval +overlay) lookup lsp magit :lang (cc +lsp) emacs-lisp markdown org (python +lsp +conda) (sh +lsp) :config (default +bindings +smartparens))
packages ((volatile-highlights) (atom-one-dark-theme) (soft-morning-theme) (csv-mode) (org-bullets) (mixed-pitch) (company-shell) (anaconda-mode) (pyimport) (py-isort) (nose) (python-pytest) (pip-requirements) (pipenv) (format-all) (conda) (lsp-python-ms) (ein) (ccls) (cmake-mode) (cuda-mode) (demangle-mode) (disaster) (modern-cpp-font-lock) (opencl-mode))
unpin (n/a)
elpa (n/a)
According to this Reddit thread, setting the variable (setq python-shell-prompt-block-regexp "\\.\\.\\.:? ") in ~/.doom.d/config.el fixed it. Should this setting be added to Doom Emacs by default?
According to this Reddit thread, setting the variable
(setq python-shell-prompt-block-regexp "\\.\\.\\.:? ")in ~/.doom.d/config.el fixed it. Should this setting be added to Doom Emacs by default?
I have tried this solution with the normal python repl (default), jupyter and ipython repl as such:
(set-repl-handler! 'python-mode #'+python/open-jupyter-repl)
(set-repl-handler! 'python-mode #'+python/open-ipython-repl)
I still get weird indenting errors when executing a whole script with gr.
The only repl that seem to work for python in doom emacs with a send-region-to-repl functionality is using the emacs-jupyter package. But that package this not seem to be very well integrated with doom. Or at least, i haven-t figured out how...
Most helpful comment
According to this Reddit thread, setting the variable
(setq python-shell-prompt-block-regexp "\\.\\.\\.:? ")in ~/.doom.d/config.el fixed it. Should this setting be added to Doom Emacs by default?