Best Practice: Rembember Application State

From Firefox I learned that applications should always save their state. When you close and restart an application is should restore its state to what it was previously. Open windows, open documents, which text was highlighted, how far down you’ve scrolled, the undo and redo buffers, etc.

Let’s use a text editor as an example. Say you have a grocery list saved on your computer. You open the grocery list and add three lines to it, but before you can save it a rabbit gnaws through your computer’s power cable and it turns off! You replace the power cable, boot your computer and start the text editor. It should:

  1. Open your grocery list automatically
  2. Restore the three lines you added before you lost power
  3. Realize that the three lines have not been saved to the file yet
  4. Let you “undo” repeatedly until the grocery list is back to what it was originally
This entry was posted in All, Computers and tagged . Bookmark the permalink.

5 Responses to Best Practice: Rembember Application State

  1. Anonymous says:

    Jordan was telling me about a demo at Java One that did pretty much exactly that. Except it wasn’t a traditional desktop PC. It was a thin client that connected to the cloud and stored all the state there.

  2. terror_firma says:

    Although if your editor is doing all of that, the concept of ‘saving’ is a little murky. Why require the user to take action to do it when it’s happening in the background for you anyway?

    Sounds like you should read The Humane Interface!

  3. whatsupdawgs says:

    Out of curiosity, are there any apps that do this? I’m happy when I find apps that restore what documents you have open and restore any changes you’ve made, but do any apps actually save your scroll point, your highlighting, and so on?

  4. Anonymous says:

    The answer is emacs

    I dunno what editor you’re using these days, Mark, but here’s the answer to your woes:

    (defun elb-after-save ()
    (desktop-save “~/”))

    (add-hook ‘auto-save-hook ‘elb-after-save)

    (desktop-save-mode t)

    It won’t automatically apply unsaved changes on restart (you have to use M-x recover-file); there may be a way to do that, but I don’t know what it is. I’ve never tried. It does the rest, though.

Leave a Reply

Your email address will not be published. Required fields are marked *