From the OPs comments I deduce that the problem is only the dialog that opens when one opens with the menu entry "Cell" -> "Notebook History" and which shows a relatively involved visualization of the history and defaults to analyze the whole notebook. Obviously that is too slow for really large notebooks. But if one only is interested in the last change of a single cell, one can use code like the following to just get that information, and I'd guess that this should work even for huge notebooks as long as these still work in general.
Here is the code which generates a palette with one button which shows the last change time for the selected cell(s):
CreatePalette@Button["Show Last Cell-Change", MessageDialog[
SelectionMove[InputNotebook[], All, Cell];
Grid[
MapIndexed[Flatten[{#2, #1}] &, Replace[
Cases[{NotebookRead[InputNotebook[]]}, Cell[___], Infinity], {
Cell[___, CellChangeTimes -> t_] :> DateString[Max[t]+3600*$TimeZone],
Cell[___] :> None
}, {1}]
]
]
], Method -> "Queued"]
for the interested here is what it does: The notebook history feature can be switched on either globally with Edit -> Preferences -> Advanced -> "Enable notebook history tracking" or just for the current notebook with e.g. SetOptions[EvaluationNotebook[],TrackCellChangeTimes -> True]
. Once that settings has been made, the Mathmatica FrontEnd adds timestamps to cells when these are edited. These timestamps are aggregated within the Cell-Option CellChangeTimes
. What my code does is to just extract that information which is in the form of timestamps as given by AbsoluteTime[]
but obviously for UTC that is TimeZone->0
. The Max
of all those values is the last time the cell has changed and that is shown in human readable form with DateString
. I have adjusted for the time zone in a somewhat ad hoc way which I have not tested for other timezones than my own but think should work. I could imagine that other things would also need improvement but it should basically work, show the idea and I would expect it to not create problems when a notebook gets large or the history is long.
EDIT
As the OP has mentioned in comments he is still searching for a way to change the default setting for the selection toggle. While a programmatic change of that might be possible it would certainly be somewhat involved and "dirty". On the other side it seems to be easy enough to just edit the system dialog definition which one can find here:
What you could do is to replace the default palette notebook which you can find here:
FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd",
"SystemResources", "HistoryOverview.nb"}]
with one where the corresponding default settings is changed. To do that, I would suggest to:
- make a copy of that notebook
- open the copy in a text editor
- replace
$CellContext`selectionOnly$$ = False
with $CellContext`selectionOnly$$ = True
- safe the file
open the edited file in mathematica and save it (to avoid messages about it being edited outside of mathematica). As the notebook has settings specific to palettes it can only be saved programmatically. To do that, you have to get a handle to the corresponding notebook object and then call NotebookSave
for that. The following code will do that:
NotebookSave[
First[Select[
Notebooks[],
Not[FreeQ[CurrentValue[#, WindowTitle], "HistoryOverviewDialog"]] &]
]
]
replace the original notebook with the edited one, probably making a backup copy of the original before that.
the last step (replacing that file in $InstallationDirectory
) will of course only be possible with corresponding file permissions.
If you now restart mathematica the history overview dialog should now open always with the "selection only" setting...