MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Re: Why does mathematica randomly rewrite notebooks?

  • To: mathgroup at
  • Subject: [mg54950] Re: [mg54904] Re: [mg54879] Re: [mg54838] Why does mathematica randomly rewrite notebooks?
  • From: Josef Karthauser <joe at>
  • Date: Tue, 8 Mar 2005 05:03:35 -0500 (EST)
  • References: <>
  • Sender: owner-wri-mathgroup at

On Sun, Mar 06, 2005 at 12:55:55AM -0500, John Fultz wrote:
> Unfortunately, revision control diffing tools really like to assume that
> all documents are basically unstructured text documents, while notebooks do
> have structure which is hard to visualize in text-diffs and are freely
> line-wrapped by the FE in such a way that can sometimes really defeat a
> straight text diff.  Also, the file outline caches (the comments at the end
> of the file used to make speedy incremental loading of notebook possible)
> can change frequently and pollute the diffs with information that's never
> useful to see.


> In fact, this isn't anything unique to notebooks.  Any structured document
> format...XML is a perfect and ubiquitous not as interesting
> when diffs are viewed textually as it is when diffs are viewed with a
> diffing tool that understands the structure.


> We do have such a structural diffing tool.  Check out the NotebookDiff
> function in the AuthorTools` package.  This function requires the two
> versions of the notebooks side-by-side on your file system, but can be
> invaluable at understanding what the heck a diff actually means.  We often
> use it internally to help with our document management.

I discovered that last week and yes it is indeed very useful.  I can now
develop away and then select just the differences that I am interested
in committing, which is much easier than when I was trying to do it by
hand looking at the .nb file.

> There are also a couple of bugs which do needlessly rewrite sections of the
> the notebook which will be fixed in future versions (the notebooks writte n
> out are correct notebooks...but the variations are not strictly necessary).

One of these variations that I've noticed is the seemingly random
interchanging of the litteral '\n' and \[IndentingNewLine].  Sometimes
they appear one way around, and sometimes the other.  This of course is
a stumbling block to decent cvs usage.

> Additionally, we've done some work for future versions to allow cvs
> keyword expansion without throwing off the file outline cache and to allow
> complete suppression of file outline caches by default.  We continue to
> look into other means of making revision control of notebooks easier.

If you're looking for another suggestion, it would be nice to have an
option to have all the output cells stripped and all open sections
closed upon writing.  (One usually doesn't want to commit output cells
to the cvs, as these can be calculated).

Also, can you give us any hint as to which version of mathematica might
have the above mentioned bugs fixed?

Josef Karthauser (joe at
FreeBSD (cvs meister, admin and hacker)
Physics Particle Theory (student)
================ An eclectic mix of fact and theory. =================

  • Prev by Date: Re: Recursion
  • Next by Date: Re: Front End Programming question
  • Previous by thread: Re: Re: Re: Why does mathematica randomly rewrite notebooks?
  • Next by thread: Re: Why does mathematica randomly rewrite notebooks?