6
$\begingroup$

When you have long notebook with hundreds of cells, you sometimes need to scroll/jump manually to your last edited cell. I dind't find any shortcut for doing that. Any ideas?

$\endgroup$
  • 2
    $\begingroup$ I don't think there is any. But maybe you can construct one by scanning the CellChangeTimes of all the cells and picking out the latest one. $\endgroup$ – Silvia Mar 28 '14 at 14:11
4
$\begingroup$

I don't think there is any shortcut for that. But we can always construct one by scanning the CellChangeTimes of all the cells and picking out the latest one.

Here is a quick solution:

Button[
       "Find me\nthe last edit!",
        {#, CurrentValue[#, CellChangeTimes]} & /@ 
           Cells[SelectedNotebook[], CellStyle -> {"Input"}] //
          DeleteCases[#, {CellObject[_], {}}] & //
         # /. {co_CellObject, timestamp_List} :> {co, Flatten[timestamp][[-1]]} & //
        SortBy[#, Last][[-1, 1]] & //
       SelectionMove[#, All, Cell] &
      ]

Select the generated button, and from the menu bar, select Palettes -> Generate Palette from Selection:

generate the palette

It should find the last edited "Input"-style cell in the current selected notebook.

Note: In order to use this solution, the notebook history tracking option should be enabled:

enable the notebook history tracking

$\endgroup$
  • $\begingroup$ It doesn't work for me. I get an Part::partw: "Part -1 of {} does not exist" error message. This may be due to the fact that CellChangeTimes sometimes contains a list with a list of values and sometimes a list with a single value. $\endgroup$ – Sjoerd C. de Vries Mar 28 '14 at 15:04
  • $\begingroup$ @SjoerdC.deVries I noticed that, too. But I've Flattened the list before doing the Part :( I'm investigating. $\endgroup$ – Silvia Mar 28 '14 at 15:07
  • $\begingroup$ @SjoerdC.deVries It seems some Cells doesn't include a CellChangeTimes option or thay're empty as Kuba said. Will fix it soon. $\endgroup$ – Silvia Mar 28 '14 at 15:11
  • $\begingroup$ @SjoerdC.deVries Kuba Have fixed the code. Cells without CellChangeTimes have been abandoned before Sorting. $\endgroup$ – Silvia Mar 28 '14 at 15:34
  • $\begingroup$ @Silvia Since you are around, please take a look, maybe you have something new to say: mathematica.stackexchange.com/q/44588/5478 $\endgroup$ – Kuba Mar 28 '14 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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