I recently noted that there is an option in the options inspector to set a merge interval for cell changes: "CellChangeTimeMergeInterval". This (I think) prevents a quick series of changes from spamming your notebook history with a bunch of times that can bloat the file size and make the history hard to inerpret. That's great moving forward, but my old heavily used notebooks already have a ton of these closely spaced change times. Is there some easy way to retroactively apply the merge interval to the notebook history?

The only thing I came up with was to grep out the times (in python maybe?) and compare them, making appropriate deletions as the file is parsed. I kind of worry that letting a script tinker with the raw notebook text risks breaking things, which would be bad, since these are my most heavily used notebooks.

You can query the setting for merge interval by:

CurrentValue[EvaluationNotebook[], "CellChangeTimeMergeInterval"]
  • 2
    $\begingroup$ Can't you just get the cell change times from each cell (it's in the expression for the cell) and use the difference to merge them? I think it could be done using only mma Notebook* functions and one needn't resort to python $\endgroup$
    – rm -rf
    Apr 27, 2013 at 22:43
  • $\begingroup$ @user64494 I rolled back the title, as in my opinion the original title is more expressing than your version. Moreover, the Q is not about the option or how it works but more about how to mimic its behavior. I understand that you wanted the option name in the title, but a search for "CellChangeTimeMergeInterval" will find the post since I've already included the name in the body. $\endgroup$ May 20, 2019 at 19:03

1 Answer 1


I think your interpretation of the "CellChangeTimeMergeInterval" setting is not correct. When two time stamps are within this interval, they get merged into a sublist. See this bullet item from the documentation of CellChangeTimes:

  • If many cell changes are made close together, the start and end times appear in a sublist within the setting for CellChangeTimes

Here is an example of the CellChangeTimes setting for one of my cells:

(# - #[[1]])& @ CurrentValue[CellObject[796385], CellChangeTimes]

{0., {142.52, 156.919}, 234.842, {274.682, 349.723}, 382.296, 448.369, {490.008, 519.604}, 640.388, 691.717, 765.146, 887.726, 922.627, {988.285, 1106.24}, {1137.63, 1158.36}, {1247.58, 1283.9}, {1335.39, 1402.24}, 1451.82, {1663.34, 1712.07}, {1747.61, 1756.51}, {1813.2, 1823.2}, {1861.09, 1876.18}, {1918.6, 1957.95}, {2014.92, 2051.53}}

where I subtracted off the first time stamp to make it easier to see the relative times. You'll notice that the setting is a mixture of single values and sublists of values.

So, one possibility is to just replace all of those sublists with their first element, something like:

removeSublists[cell_] := Set[
    CurrentValue[cell, CellChangeTimes],
    Replace[CurrentValue[cell, CellChangeTimes], {t_, __} :> t, {1}]

removeSublists /@ Cells[]

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.