# Running MathKernel from Emacs brings cursor to end of line

When I start MathKernel from the Emacs shell, there are always extra spaces inserted so the cursor goes to the far right side of the screen.

For example

% emacs -q M-x shell /Applications/Mathematica.app/Contents/MacOS/MathKernel


produces

Mathematica 9.0 for Mac OS X x86 (64-bit)
In[1]:=                                                                       |<-


where I am using |<- to show where the cursor is after the 70 whitespace characters are inserted after In[1]:=.

Does anyone knows why such a thing happens and how to prevent it?

-