Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Auto-Save/Backup Copy Functionality #60

Closed
RickStrahl opened this issue Dec 1, 2016 · 16 comments
Closed

Add Auto-Save/Backup Copy Functionality #60

RickStrahl opened this issue Dec 1, 2016 · 16 comments

Comments

@RickStrahl
Copy link
Owner

NOTE: This topic is primarily here for discussion of how to best implement this feature.

Markdown Monster should automatically create a backup copy of the open file every few minutes (configurable) so that in case of a failure of some sort the document text is not lost.

Here are some starter thoughts:

Approaches

  • Use .md.tmp files to create backup file - delete when doc is closed
    • Pro: Easy to implement, easy to figure out what it means
    • Pro: Easy to known when to ask for auto-recover (ie. file exists on open)
    • Con: extra file that might show up in source control commit dialogs
  • Use temp file in Temp Folder
    * Pro: No interference with source control
    * Con: Messy to track
    * No good way to auto-recover

Please discuss.

@Mehul
Copy link

Mehul commented Dec 1, 2016

Not sure how Sublime handles it but I love the way it does it. I use the portable version so the autosave is great when I work on different machines.

@RickStrahl
Copy link
Owner Author

RickStrahl commented Dec 1, 2016

Oh really? I didn't know Sublime does that. How could it possible get that across machines? Unless you use dropbox to store files.

@Mehul
Copy link

Mehul commented Dec 2, 2016

@RickStrahl Yes, I use dropbox to store files and it must store the temp files in dropbox too because I'll open a new document, edit it, close sublime w/o saving, and when I open it at home, it's there.

@Mehul
Copy link

Mehul commented Dec 2, 2016

@RickStrahl speaking of which, is it possible to have a portable version of MM that I can use in a similar way please? :)

@RickStrahl
Copy link
Owner Author

MM is portable as is. Once installed you can copy it to a ZIP file and unzip elsewhere and it should just work. The only thing missing will be file association, command line support (path set) and possibly some edge case security issues with configuration updates (missing permissions).

But the main application is fully self contained as long as .NET 4.5+ is installed.

@Mehul
Copy link

Mehul commented Dec 2, 2016

Nice, I'll may try that. Btw, these links maybe helpful:
http://superuser.com/questions/894021/where-does-sublime-text-store-its-un-saved-windows
microsoft/vscode#101

@RickStrahl
Copy link
Owner Author

@Mehul FWIW I've created a portable distribution that gets published now on the download page:
http://markdownmonster.west-wind.com/download.aspx

Click the Portable Zip link. If you run into issues with this please open a separate issue so we can track this better.

@Mehul
Copy link

Mehul commented Dec 6, 2016

That's awesome, thanks, I'll give it a try now.

@Mehul
Copy link

Mehul commented Dec 6, 2016

@RickStrahl Portable version (and alt--v-b fix) is working great, thanks. Still would love to see that auto save. :)

@RickStrahl
Copy link
Owner Author

Added auto-backup save functionality that updates in the background while editing your document. If MM crashes the backup file is persisted and when you repopen MM and hte affected file, both the original file (which might be incomplete) and the backup file are opened and you can copy the text from the backup file into the actual document.

Files are named *.saved.bak.

0904c9b

@RickStrahl
Copy link
Owner Author

RickStrahl commented Dec 16, 2016

This feature is now available in 1.0.28 at https://markdownmonster.west-wind.com/download.aspx. You have to explicitly set the AutoSaveBackups config setting.

@Mehul
Copy link

Mehul commented Dec 16, 2016

@RickStrahl thank you for adding this. Here's the feedback :)

I've enabled the feature in config, however, when I close MM, and if I have any unsaved files, it prompts me to save them first. I suppose this feature that I'm describing is probably close to AutoSaveDrafts or something.

@RickStrahl
Copy link
Owner Author

It's not meant to be auto-save - it's auto-backup, so if you crash the auto-saved version is available to you.

@Mehul
Copy link

Mehul commented Dec 16, 2016

Fair enough. Do you still plan to add auto-save? Just curious. It's not as important but I do find it it convenient.

@RickStrahl
Copy link
Owner Author

I suppose it'd be easy to implement auto-save as we could just write to the actual underlying file rather than the backup file. If supported the option would be off by default cause frankly it's not a good idea most of the time. If you're screwing around with a document, experimenting etc. there's then no way back to abort changes (other than Ctrl-z many times to last save).

@RickStrahl
Copy link
Owner Author

1.0.31 is live now (from the download page) that adds true Auto-Save behind a new AutoSaveDocuments flag. Documents are written to disk immediately (after a 1 second type delay) when this mode is active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants