I am experimenting with logo designs in Mathematica (8 or above) using the notebook interface and I want to change the generating formula A LOT. The problem is I only know SHIFT + ENTER which makes me jump outside my current cell and lose my position.
Is there a way to evaluate the current cell without leaving it and losing your position within it? So: Evaluate a cell and land back inside the same cell at the exact position I pressed SHIFT + ENTER at.
What I once came to use was along the lines:
a = Exp[1.994 \[Pi]/(3 I)];
b = Nest[{#, a #, a\[Conjugate] #, #} &, 1, 5];
{Re[#], Im[#]} & /@
Accumulate[
Flatten[{0, a b, a\[Conjugate] b, -b}]] // {\[Rho]\[Chi], # //
Line} & // Graphics
NotebookFind[EvaluationNotebook[], "E" <> "xp", Previous];
but I hope there is just another key combination or sth. that I am not aware of.
Edit:
a = Exp[(*1*)1.994 \[Pi]/(3 I)];
b = Nest[{#, a #, a\[Conjugate] #, #} &, (*2*)1, (*3*)5];
{Re[#], Im[#]} & /@
Accumulate[
Flatten[{0, a b, a\[Conjugate] b, -b}]] // {\[Rho]\[Chi], # //
Line} & // Graphics
Do[NotebookFind[EvaluationNotebook[], "(*1*)", Previous], {2}];
is a nice little improvement to my solution as partly suggested by Chris Dengen.
Edit 2:
NotebookFind[EvaluationNotebook[], "(*1*)", EvaluationCell]
This solves:
- these only work with cells that produce one or a known number of output cells
EvaluationCell is sparsely documented so hard to find in fact I just stumbled upon it. Using the EvaluationCell the search starts from above (eliminating the Do twice construct) as we do not come from an output cell further down the screen.
What remains to be solved:
- one needs to do manual cell-keeping (bookkeeping at cell level) to land at places of interest
- using comment-based landing markers clutters the input cells
Note This question is about not losing current position when one presses SHIFT + ENTER inside a Mathematica notebook cell. It is not about content or Manipulate. Sorry for not making that clear at the beginning.
Temporary Note
Now trying the following:
- use event handlers to define an alternative evaluation key combination
- when triggered, find a way to store the exact keyboard position in the current input cell
- evaluate the current input cell
- restore the position in the current input cell
I internally hope some function might just take care of the store/restore by chance being optimistic. Being realistic though, I first hope I can even find a way to get at the current keyboard position. Will follow up here if anything materializes out of my attempt.