Kyle Meyer wrote: > Richard Stanton wrote: >> This looks great. While we're patching this code, why does having >> blank lines inside function definitions cause such problems in >> :session mode? > > I think this is because the lines are being sent one by one, so sending > the blank line causes an issue, like typing enter with the cursor at _: > > >>> def abc(): > >>> _ > > ... > File "", line 2 > > ^ > IndentationError: expected an indented block > >>> > > I'll take a look at fixing this. python.el in Emacs 24 seems to send > functions with blank lines over fine, so perhaps I can use it as an > example. I've attached two patches. The first one is a proposed way to deal with the indentation issues in sessions. It is very similar to what python.el does for multiline input (use a temporary file and then execute that from the shell). The second is an update of my previous patch to remove shell prompt characters that are leaking into the output.