Notepad++ exit



  • When I hit Alt-F4 I want notepad++ to exit and save all changes and close all documents. Like all other applications do. Which setting should be changed to work like that?



  • @Uffe-Kousgaard said:

    Like all other applications do.

    I cannot think of many applications that automatically saves changes on Alt-F4 closure. Some will ask if you want to save – and Notepad++ can be made to do that.

    Really, it’s quite foolish to rely on your application to do the saving for you, because there are times (crashes, etc), when no matter how well-programmed the application is, it won’t be able to save before the process is terminated. I’d rather know I need to save often, and have applications ask me if I’d like to save if I do something foolish like trying to exit with unsaved changes, but I will not blame the application for my own lack of saving. My files are my responsibility.

    With those warnings, Settings > Prefernces > Backup will allow you to change the auto-save settings.

    If you enable both ☑ Remember current session for next launch and ☑ Enable session snapshot and periodic backup, then every 7 seconds (or whatever you define), Notepad++ will save a copy of your open-and-edited file(s) to the %AppData%\notepad++\backup folder (or whichever folder is listed in the dialog). But if you do it that way, it will not ask you to save the file in the file’s normal location if you try to close with unsaved changes. When you re-open, it will still mark your file as changed-but-not-saved, and the “main” location of the file will not yet be edited. Many people like this version, but I don’t, because it doesn’t actually save the file where I expect it to be saved, and it teaches people that it’s okay to be lazy and not take control of their own critical data integrity. (Also, when it’s saving about 1sec out of every 7sec, that gives it a 1-in-7 chance that any crash in the application or in the OS will cause partial or invalid data to be written to that backup – and then you’re in a situation where the main file is horribly out of date because you chose not to manually save, but the backup is invalid or corrupted; and that, in my opinion, is worse than the alternative.)

    If you enable ☑ Remember current session for next launch but disable ☐ Enable session snapshot and periodic backup, then whenever you try to close an edited file – whether it’s by clicking the x on the tab, or File > Close, or clicking the X on Notepad++, or File > Exit, or Alt+F4, it will pop up a dialog for every changed file, and ask if you’d like to save the changes. I find this much safer, because then every save to the filesystem is an intentionally action on my part.



  • @PeterJones said:

    Remember current session for next launch

    Disabling “Remember current session for next launch” and choosing “Simple backup” made it behave in a sensible way.


Log in to reply