Re: UNDO and Mathematica - how useless is it?
- To: mathgroup at smc.vnet.net
- Subject: [mg98557] Re: UNDO and Mathematica - how useless is it?
- From: dbreiss at gmail.com
- Date: Sun, 12 Apr 2009 03:49:57 -0400 (EDT)
- References: <200903251042.FAA24502@smc.vnet.net> <23582715.1238067049865.JavaMail.root@m02>
Yes, this is very similar to the approach within A WorkLife
FrameWork.... there is a means there to also add associated comments
associated with each backup. But it's clear that one can write a
tool that does this without the full machinery of my package...
...David
On Apr 11, 4:00 am, Albert Retey <a... at gmx-topmail.de> wrote:
> Hi,
>
>
> I think for just having backups for your notebooks the possibility to
> use a full featured version control system from within the workbench is
> overkill. The automatic history which eclipse offers for textfiles is
> AFAIK not something that automatically works for mathematica notebooks
> (does it? can it work for an external editor at all? I use SVN with
> workbench which turns automatic local backups off).
>
> The following will add a simple menubar to your notebook which will let
> you save a backup with the current date/time encoded into the filename.
> Just press the backup button whenever you think is appropriate to create
> a "version". This could of course be further improved and adopted to
> your needs, maybe a directory hierarchy would be handy to make it easy
> to delete backups of certain periods that you don't need anymore. Also
> some additional buttons to manage the versions directly would also be
> nice and some error checking would certainly also be a good idea. There
> are no guarantees that this way you will never loose work, but it should
> basically do what it is supposed to...
>
> SetOptions[EvaluationNotebook[],
> DockedCells -> Append[
> DeleteCases[
> DockedCells /. Options[EvaluationNotebook[], DockedCells],
> HoldPattern[Cell[___, CellTags -> {"BackupMenuBar"}, ___]]
> ],
> Cell[BoxData[ToBoxes@Row[{Button["backup",
> Module[{backupname, backupnb},
> backupname = StringReplace[
>
> ToFileName[
> "FileName" /. NotebookInformation[ButtonNotebo=
ok[]]],
>
> fname___ ~~ ".nb" :>
> fname <> "_" <>
> DateString[{"Year", "-", "Month", "-", "Day",=
"_",
> "Hour", "-", "Minute", "-", "Second"}] <>=
".nb"
> ];
> SelectionMove[ButtonNotebook[], All, Notebook];
>
> backupnb =
> NotebookPut[
> Notebook[NotebookRead[ButtonNotebook[]],
> Visible -> False]];
> NotebookSave[backupnb, backupname];
> MessageDialog["backup saved to: " <> backupname];
> NotebookClose[backupnb];
> ],
> Method -> "Queued"
> ]
> }]
> ], "DockedCell", CellTags -> {"BackupMenuBar"}]
> ]
> ]
>
> hth,
>
> albert