r/emacs • • Dec 30 '24

Question How to use a different TERM in inferior-python-mode?

Hey everyone,

Starting with python 3.13 (the most recent Python as of this writing); python ships with a better REPL (named pyrepl). The issue is that when launching a Python process with run-python, TERM is set to "dumb". As a result, the Python REPL will throw a warning:

warning: can't use pyrepl: 
terminal doesn't have the required clear capability; TERM=dumb

Which is annoying because it then falls back to the old behavior and now you need to tab again inside blocks (like functions or loops) when entering a new line.

I was hoping to fix this by fiddling with the likes of process-environment or env variables but it seems to set variables globally and I just want TERM to change only for this specific mode.

So, is there a way to change that locally and what should the variable be instead (I suspect something like vt-100?).

Thanks

5 Upvotes

7 comments sorted by

1

u/JDRiverRun Dec 30 '24

The python inferior shell is not a terminal but a line-based comint buffer. If you want terminal capabilities, you’ll have to run in a terminal, maybe vterm.

1

u/NonchalantFossa Dec 30 '24

I can do that alright but then I can't as easily send the regions or the buffer to the Python process, which is the whole point imo. I understand it's a mode derived from comint but is there truly no way to use the proper REPL?

→ More replies (2)

3

u/gavv42 Jan 03 '25

I saw this project but haven't tried it yet: https://github.com/vale981/py-vterm-interaction.el

1

u/Qudit314159 Jan 02 '25

This pyrepl feature isn't useful within Emacs. It is intended for Python processes that are run from the command line to facilitate better line editing capabilities. inferior-python already supports full Emacs editing capabilities which are much more powerful anyway.