New behavior for Auto-save, versions, and "save state" [Guide]

Discussion in 'Mac OS X Lion (10.7)' started by mrblack927, Mar 1, 2011.

  1. mrblack927, Mar 1, 2011
    Last edited: Mar 1, 2011

    mrblack927 macrumors 6502a


    Aug 19, 2008
    Hi all,

    I've been playing with Lion for a while now and I think I've finally figured out exactly how this new file management philosophy works with Lion. Forgive me if some of this has been posted before. I just wanted to get it all in a concise guide of sorts.

    So, first of all, it should be noted that this functionality appears to be implemented via new API calls. That means that developers will have to update their apps to support it. Obviously right now the only apps that could do that are Apple apps. For this demonstration I will be using TextEdit, which appears to have everything built in already.

    Here we go...

    Open a new TextEdit file
    Nothing new here, the app starts and you can start writing.


    Quit TextEdit without saving (cmd+Q)
    Here's where things get weird. You would expect it to prompt you to save the file, or at least store it somewhere with Versions. But it doesn't, it just quits. Where does your file go?

    Open TextEdit again
    Answer: It didn't go anywhere. When you open the app again, your file is still there as if nothing changed.


    Even though the app was completely terminated and removed from memory, the "state" was saved. This is similar to iOS multitasking. So how do we close out this file and get rid of it? Well, it seems this is now the responsibility of the window, not the app.

    Close the TextEdit window (cmd+W)
    Now the app prompts you to save the file. If you choose no, the file will be trashed, otherwise, it will be saved as the name you give it. After that, you can quit the app and it will be in a "new state" the next time you open it.


    Open the saved file
    The file opens as normal, but now you have a little arrow in the top right corner.


    This is for Versions. You can lock, revert, or compare versions by clicking on this arrow. If you lock the file, it will be in read-only mode. Versions will stop taking snapshots and any changes you make will have to either be unlocked or copied to a new file.


    Editing a saved file
    The neat thing about versions is that after you save it the first time (ie. give it a file name) all future saves are handled by OSX and stored with Versions. For example, textedit knows that you edited the file:


    And when you close the window (cmd+W) it will be automatically saved as a new "version". There is no prompt, and no need for user input. The next time you open the file, it will show you the latest version. If you want to see an older version, you can just click "browse all versions".


    Reverting files
    The Versions browser is similar to the Time Machine interface. It's a little unpolished right now (no animations), but of course this is just the first beta. Functionally, it is all there. You can "go back in time" to see older copies and even copy and paste text from a saved version to the current copy. Or revert entirely.

    Click to see full screen pic of Versions

    So what have we learned?
    Well, some things have been considerably moved around, but all previous functionality seems to still be there, and much of it has been improved. Most notably, a lot of people have been worried that "quitting will not restore an app to a clean slate". Well, that's true, but closing all windows and then quitting will. Apple seems to be moving towards more per-window management instead of per-app. Cmd+W carries more weight now.

    Edit: Also...
    It turns out that you don't need to quit anymore! If you close all open windows, the app will automatically quit itself as soon as you move on to something else. For example, clicking on the Safari window causes TextEdit to quit, as long as there are no TextEdit windows open. Neat!

    This is basically our first look at a new productivity paradigm. You will be able to quit all of your apps (or even restart) without fear of loosing anything. You will be able to edit things without constantly resaving. Like most things it will take some getting used to but overall it seems like a step in the right direction.

    Shoot away with questions if you have any.
  2. zorinlynx macrumors 601


    May 31, 2007
    Florida, USA
    How does the OS handle versions on a filesystem level? Does it store the version information in the resource fork (metadata) or does it store it somewhere else?

    If you're working on a file stored on a network volume on a non-Macintosh system (linux fileserver with samba for instance) does versioning still work? Does it depend on the Apple double (._) resource forks to store the data?

    I'm the sort of user who had to know how everything works. So my curiosity is on fire here!
  3. mrblack927 thread starter macrumors 6502a


    Aug 19, 2008
    Good questions. The Versions appear to be stored in a special new volume called "MobileBackups", located at /Volumes/MobileBackups. It appears to use the Time Machine subsystem to handle this which is a per-disk process so I would assume off-disk resources (such as network files) are unsupported, though I have not tested this yet. See the attached pic for a look at the MobileBackups volume. Every one of those folders contains the entire folder structure for your primary disk (in my case "SSD"). Obviously it can't back up the entire disk every hour, so I'm assuming it does a differential backup, maybe even using a special kind of symbolic link for files that haven't changed. The MobileBackups volume is kind of a mystery right now though. The file system sees it as having 0 MB free and taking up an unknown amount of space. It seems Apple is doing some magic behind the scenes there. You'd have to ask someone more well-versed in filesystem structures than me exactly what is going on.
  4. jeznav macrumors 6502


    Aug 10, 2007
    I can also add that the system is doing delta backups. It could be that Time Machine also handles

    There's a command line described in devforums that gives more information on how it works:
  5. kuwisdelu macrumors 65816

    Jan 13, 2008
    Don't think I like that...
  6. hellomoto4 macrumors 6502a


    Jul 11, 2008
    Is Autosave/Versions implemented into Pages? I can't seem to find it.
  7. Cougarcat macrumors 604

    Sep 19, 2003
    No, it'll require an update.
  8. tourada macrumors regular

    Feb 27, 2011
    Wirelessly posted (Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148a Safari/6533.18.5)

    Pages is still from '09. It has to be updated to allow for versions or any other lion feature (like fullscreen). My bet is iWork will get an update come summer
  9. Cougarcat macrumors 604

    Sep 19, 2003
    ...or tomorrow? iWork '11, compatible with iPhone, OS X, and iPad?

  10. hellomoto4 macrumors 6502a


    Jul 11, 2008
    I thought that might've been the case.

    As cougarcat said, it would be awesome to see it tomorrow </wishfulthinking>
  11. kuwisdelu macrumors 65816

    Jan 13, 2008
    A few questions, if anyone has answers:

    Does Lion offer any finer control over how long between Auto-saves/Versions? For some documents, an hour can be a long time between saves...

    Is there anyway to force a new save/version any time I want? If there's a big change I want to make, can I force an version snapshot before I make it, and then another after I make it?

    Also, if I leave a file open for a long time without making changes to it, will I end up with a bunch of different versions? Or is it smart enough not to create a new version if it sees there's been no changes?

    If anyone knows these or takes the time to find out, thanks!
  12. Steve Ballmer macrumors 6502

    Steve Ballmer

    Oct 2, 2009
    Redmond, WA
    Ideally, by the time Lion hits GM, we'll have iWork '11 and a 64-bit Cocoa iTunes.

    And thanks for this guide, I get how Versions works but it's still a bit awkward, only because I'm so used to saving every five minutes. But I'll get used to it.
  13. Cougarcat macrumors 604

    Sep 19, 2003
    You can't control how frequently it autosaves, but any time you save normally it creates a snapshot. So yes, if you are going to make a big change, Apple-S before and after will give you the snapshots you want.

    Versions is essentially time machine for documents, so yes, it's smart enough not to do that.
  14. kuwisdelu macrumors 65816

    Jan 13, 2008
    Ah, great, at first it sounded like normally saving didn't do anything if you had Versions turned on, and it only allowed auto-saving. Very glad that was just my misunderstanding. :) That's perfect. :D

    I only use TM for backup, and haven't really needed to use it that way, so that's good to know. Thanks!
  15. ErikGrim macrumors 68030


    Jun 20, 2003
    Brisbane, Australia
    In addition to saving regularly, keep it mind it will always keep the latest changed to your document. The hour rate only pertains to older versions.

Share This Page