PrimalScript: Restore Points
- Written by Alexander Riedel
- Last Updated: 19 April 2016
- Created: 17 March 2014
- Hits: 5407
We have all done it. We started messing with code and changed it to the point where it just won’t work anymore. If you employ some kind of version control or backup you usually have some kind of previous version to save the day, but that really depends on how diligent you are with checking files into source control.
Oh yeah, I know you wished you had made a copy of that file before you started messing with it. PrimalScript does that for you, so stop worrying.
The Backup properties have additional settings, all turned on by default.
You get two kinds of restore points; automatic and manual. The automatic ones are created as soon as you start modifying a file.
PrimalScript simply copies the file when you start editing. The file is hidden, so unless you turn that on you won’t even see it. Since the file was automatically created it will also be deleted at the end of your session. That is an important point. It will be deleted when you exit PrimalScript, not when you close the file. Because you know, once you closed the file and emailed it to whoever needed it, only THEN will you find out you have done something you shouldn’t have. So just open the file and rewind. How do you do that you ask? Simple, there are two ways:
The document tab context menu has a new topic; Restore Points. Just hit Rewind and PrimalScript will copy the temporary file back and load that, discarding anything you have done so far. The second way is to use the Tools tab in the Ribbon.
Just hit “Rewind”. And no, we did not add hotkeys to any of this, we wouldn’t want an errant mistyped key to eradicate everything you did since the morning, would we?
Looking at that Ribbon brings us to the manual type of restore points. Click the Create button and the currently saved state of your file is copied to <filename>.RestorePoint.<extension>
Again, the file is hidden and unless you have hidden files turned on you won’t even see it. Unlike temporary restore points these files are not deleted at the end of a session. This will only be deleted when you select Delete from the tab context menu or the Ribbon. So now even days later you can restore to a known state in just one click. If you hit Create restore point again, PrimalScript will just quietly update the restore point to the current state. So there are no multiple versions of that file. If you want versions, you still need to use some kind of version control.
It’s not really a big feature, but we hope it can help you out here and there when you've coded yourself into a corner.