Bug? Closing Notepad does not ask to save edited file
Doug Edmunds last edited by
Using v7.6.3 (64 bit) on Win10 Home
I find that I can make an edit to a file then close NotePad++ (not closing the file) without it asking if I want to save the changes to the file on the screen.
If I try to close the edited file, it works correctly, asking me if I want to save, but if closing the program, it does not ask!
How can I fix this so I don’t lose my edits?
Terry R last edited by
Can you look at Preferences (Main Menu), then Backup (shown at left side of window). You likely have ticked the options “Remember current session for next launch” and/or “Enable session snapshot and periodic backup”.
I have both ticked and can edit a doc, then close NPP without it asking me about saving. When I re-open NPP I have the recent edits still showing, so I haven’t lost anything.
PeterJones last edited by
I’m not sure which of these you want for your unsaved files when you exit:
- to be able to exit with unsaved changes, have it NOT ask, then the next time you load, have the unsaved file still maintain the previous unsaved values, or
- to be able to exit with unsaved changes, have it ASK, then if you save, the next time you load, the saved file will be loaded with the values when you exited
Either way, you need the
☑ Remember current session for next launchenabled.
- If #1, also need
☑ Enable session snapshot and periodic backupenabled, like @Terry-R.
- If #2, you need to disable
☐ Enable session snapshot and periodic backup
Assuming everything is working normally, with #1, when you load Notepad++, the file should never be more than 7 seconds (or whatever you set the “backup every ## seconds” setting to) out of date. However,
- if Notepad++ crashes during that 7-second backup, good luck (in theory, the backup should be accurate, but…)
- if Windows crashes, good luck (when windows crashes with open filehandles, data can get corrupted)
- if you have Settings > Preferences > Multi-Instance set to anything but
☑ Default (mono-instance), especially if you’ve got the same file open in multiple instances, good luck (actually, I don’t think even luck will help you this time)
Personally, I don’t trust my critical data integrity to any one piece of software (auto-backup settings, etc). I use #2 by disabling the periodic backup (because I don’t want it to ever let me exit Notepad++ with unsaved work without prompting me to save). Then I manually and intentionally “save early, save often”. And I have my backup software running in the background, looking for changes to the files on disk every 15min. And on mission-critical files, I use version control and commit often with meaningful change messages – I use subversion, but git or another version control software would work, too.
Some are less paranoid than me. Like @Terry-R says, he does enable periodic backup, and apparently is willing to exit notepad++ with unsaved changes. But in my mind, once I finish closing a piece of editing software (like Notepad++), it seems silly to rely on that software to keep track of changes that I made but didn’t intentionally save; if I want the information kept, I will hit save.
Terry R last edited by
Like @Terry-R says, he does enable periodic backup
I actually do separate backups on critical files. So whenever the ‘floppy disk’ icon lights up in the top menu I will save (shortly thereafter) any critical file. I also have the 2 options ticked so that for ALL other files (generally scratch or test files) I leave it up to NPP to handle the edits (backups) for me.
You are right about crashes, we have seen a lot of postings in this forum where the poster left it ENTIRELY to NPP to handle backups, only to find at some critical moment it failed them. Not necessarily NPP’s fault, it can be attributed to lots of sources, many external to NPP.
And the statement about not trusting critical data integrity to any one software is a good idea. When it’s critical one needs to take care of business themselves, rather than leave it to automated systems. 99.9% of the time it’s all good, however ‘Murphy’s Law’ states when you don’t want it to happen it will!