Auto Save Options

Posted June 30, 2008 by Kyle Conroy in auto save

Currently, TaskPaper does not auto-save the actual text file. Instead it creates a temporary file. In the new development snapshot, there is an option to save on the exit of TaskPaper. However, I do not close Taskpaper that often, opting instead to keep it open so that I can add tasks whenever I need. Would it be possible to add an auto-save preference that would allow the original file to be auto-saved instead of creating a new, temporary file? I believe that Stickies offers the functionality I am describing.

jesse - July 1, 2008 10:29 AM

Currently, TaskPaper does not auto-save the actual text file. Instead it creates a temporary file. In the new development snapshot, there is an option to save on the exit of TaskPaper. However, I do not close Taskpaper that often, opting instead to keep it open so that I can add tasks whenever I need.

It's true that TaskPaper's autosave is saving to a temporary file, but i still think it's a pretty save way to save. As long as you don't choose Quit, and then choose not to save, you data should be safe. So while it probably makes sense to remember to save more then every few days, I don't think you are really putting your data in danger by not saving more often.

Would it be possible to add an auto-save preference that would allow the original file to be auto-saved instead of creating a new, temporary file? I believe that Stickies offers the functionality I am describing.

I already have way to many preferences, and I'd really like to avoid adding to many more. In this case I think you could use applescript to work around the problem. This script will check if TaskPaper is open, and it it is then it will save all open documents:

tell application "System Events" to set taskPaperIsRunning to (name of processes) contains "TaskPaper"

if taskPaperIsRunning then
    tell application "TaskPaper"
        repeat with eachDocument in documents
            tell eachDocument to save
        end repeat
    end tell
end if

I don't remember the exact way to do it, but you can invoke this script from the command line, and once you do that you could setup a cron task to run this script every 15 minutes or so. I think that would do just what you want.

Shannon Hendrix - July 15, 2008 7:32 PM

Um... this makes no sense to me at all.

Autosave in every program I have ever used saves the file you are working on, except for a rare few which work with backup files, and even they usually save the current file.

Not every exit of Task Paper is planned, and I really would rather my file was saved automatically, not some temporary version of it.

jesse - July 15, 2008 9:42 PM

Sorry if it doesn't make sense at first, but I do think it's the correct way to do things for two big reasons.

First, 99% of the behavior is provided by Apple's cocoa frameworks. I just flip a switch and say "turn on autosave". That means two things, first the code for autosave is well tested, you won't lose data as I work on a new autosave implementation and enconter bugs. It also means that since this is the "default" way to support autosave over time other applications will support it using the same mechanism... so I'm going with the flow and doing things the normal way.

Second auto-saving to a separate file is really much safter then auto saving to the original file. If you save to the original file then when the app crashes it's possible that you will have saved changes that you hadn't intended to save... ie maybe you were just messing around with the file trying something out, but then after the crash you can't get back to the files original state.

ClintMacD - July 15, 2008 10:15 PM

…auto-saving to a separate file is really much safter then auto saving to the original file.

That makes perfect sense. Perhaps the confusion comes from calling it “Auto-Save,” which invokes the standard user meaning of the File > Save menu. Maybe you could rename it to something like “Auto-backup” or “Crash Recovery.”

(In which case, I would like to make a feature suggestion: a true “Auto-Save” function — Save my file every few minutes if there are unsaved changes in the document — would be very useful.)

Best wishes,
Clint

Kyle Conroy - July 16, 2008 2:20 AM

Clint,

This is the exact functionality I would want.

Shannon Hendrix - July 16, 2008 4:21 PM

I see now that a file is saved in the same directory marked as an autosave backup.

I guess that's OK though it would be nice if Task Paper offered to use it when you reload the program after a crash or other unexpected exit.

It also offers no protection in a very common scenario:

  • task paper crashes
  • user runs task paper again and it loads the file, perhaps with missing data
  • task paper auto-saves new data before user exits to load old temporary save file, so they can never recover the lost data

This is pretty common.

It seems that if Task Paper crashes or is killed, it should make note of that and offer to load the backup copy, otherwise the user may unknowingly destroy his backup.

I have lost data several times because of this, and I didn't not know that Task Paper was creating that auto save copy.

Now that I know, I will make sure I check first, but it's a manual step that a lot of users are going to forget and thus lose data.

Maybe in the event of a crash, you could save the last auto-save separately to avoid overwriting it.

I think Cocoa provides ways for you to tell if the program existed abnormally the last time.

jesse - July 21, 2008 9:55 AM

It also offers no protection in a very common scenario:

This scenario should already be taken account of. Anytime you open a document TaskPaper (or really Apple's framework code, remember I'm just flipping a switch to get these features) will automatically check for those autosaved files. If it finds an autosave file it will automatically open that file for you, and then it will mark your documented as edited (little black dot in the red window close button).

You should never need to remember to open the autosave files yourself. That should all be handled automatically for you. Try this scenario:

  1. Create a new document. Enter the text "Hello World". And Save it.
  2. Now enter a new line "my unsaved edits".
  3. Wait a few seconds for autosave to kick in.
  4. Now use "Activity Monitor" to force quit TaskPaper... from TaskPaper's perspective that's the same as a crash, it won't have time to save.
  5. Now open the document that you were editing again.

It should contain the text:

Hello World.
my unsaved edits.

The red window close button should have a dot in it because the "my unsaved edits" have not yet been saved into the file (just into the backup file). Now close the document. It will also you if you want to save your changes.

I don't think there is any place in the autosave system where you can loose data.

Topic's comments