It is possible to evaluate a cell and for the cursor to remain in its position within the code in the current cell?

For example, when I evaluate:

In[406]:= 1 + 2 + 3

Out[406]= 6

I want the cursor to remain, say, after the number "2". I know this is related to the question here, but the answer there only allows the cursor to be placed at the end of the input cell (after the "3" in the example above).

To give some context, I find I always want to do this when tweaking graphics. Take the following code:

insplot = Plot[Sin[x], {x, 0, 2 Pi}];
Plot[Cos[x], {x, 0, 2 Pi}, Epilog -> Inset[insplot, {3, 0.5}, {0, 0}, 2]]

which will place the sin plot within the cos plot. To get this to look good one needs to adjust the parameters which enter the Inset function which position and size insplot. I want to be able to change these and evaluate the cell without having to click back to the position of those parameters after each evaluation.

  • $\begingroup$ Thanks @Kuba. I did have a good look into this, but couldn't find what I want. With SelectionMove it seems possible to put the cursor at the end or beginning of the code in the evaluated cell, but not somewhere within the code. $\endgroup$
    – PatrickS
    Commented Nov 17, 2015 at 19:45
  • $\begingroup$ Thanks @Kuba but I have tried this an a few other variants and nothing seems to work. $\endgroup$
    – PatrickS
    Commented Nov 23, 2015 at 13:40
  • $\begingroup$ @Kuba. When I use SetOptions[EvaluationNotebook[],CellEpilog :> (SelectionMove[EvaluationNotebook[], All, EvaluationCell];SelectionMove[EvaluationNotebook[], After, CellContents];)] I find that following evaluation of a Cell I end up with the Cell highlighted (not the Cell text, but the bar to the right highlighted). $\endgroup$
    – PatrickS
    Commented Nov 23, 2015 at 13:45


Browse other questions tagged or ask your own question.