Say, we've entered the following in the normal ipython shell.

In [1]: 1+1
Out[1]: 2

In [2]: 1+2
Out[2]: 3

In [3]: 2+4
Out[3]: 6

If I now enter:

In [4]: 1+

and press the up arrow key, ipython will offer +1 and +2, i.e. I can skip over 2+4. How do I replicate this behaviour using Emacs' ipython shell (IPy mode).


1 Answer 1


Not sure which ipy mode, You are referring. I use ipython shell which comes with elpy. It also has the same problem.

By default up arrow (or M-p) are bind to (comint-previous-input ARG). So no matter what You have at cursor, it just shows the previous input.

There is another function called (comint-previous-matching-input-from-input N) which basically gives the previous matching input for the input at cursor. It is bind to C-c M-p.

So if type something and press C-c M-p it takes to previous match.

  • 2
    Thanks, that was exactly what I was looking for (indeed, I was refering to ipython) Jul 18, 2015 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.