Enable Session Snapshot and Periodic Backup Box Unchecked
Hi, the thread at Running multiple instances of Notepad++ with regular autosave kind of turned into an editorial on unsaved “new 1” tabs before the issue at hand was addressed.
I’d like to revive the discussion about the “Enable session snapshot and periodic backup” checkbox becoming unchecked. It doesn’t seem like a desirable behavior, regardless of how the feature is meant to be used.
I rarely use multiple instances of NPP. Every time I do, the session snapshot and periodic backup box becomes unchecked. Re-checking the box restarts backups immediately, and in the specified directory, but the box comes unticked after an indeterminate amount of time regardless of whether I’ve opened a second instance of NPP since the last occurrence.
I’m glad to provide more information.
Thanks for the response @Peter-Jones
I had a go at changing the
arc diffcommand to only run
"C:\Program Files (x86)\Notepad++\notepad++.exe\"however Phabricator did not like this at all.
The file for the commit opened in my already open notepad++ window but when I tried to save, it complained I needed to reopen notepad++ so that it was running as Administrator. I reran the test with notepad++ opened as Administrator but when I tried to save, it simply stated “Save Failed: Please check if this file is opened in another program”
I then tried to modify my command to run as
"C:\Program Files (x86)\Notepad++\notepad++.exe\" -multiInst. This was technically better in that I was able to save my commit however, in this case it opened an additional copy of all the files I already had open in notepad++ (including both saved and unsaved documents). I then had to close not just the tab for the commit but the entire window containing the additionally opened copy of all my files. As such this doesn’t seem like the preferred option either.
The above 2 tests probably explain why the recommended command from Phabricator included
-multiInst -nosessionin the first place.
With that ruled out, I will take a look at using portable notepad++
To confirm, installing an additional copy of notepad++ seems to work though it very much feels like a workaround.
The point at which I need 2 installations of notepad++ on my computer to ensure running the
arc diffcommand doesn’t disable backups makes me think I would be better specifically setting
arc diffto use an editor other than notepad++ (eg vim which is pre-installed with gitbash)
though it very much feels like a workaround.
Yes, this is the Community forum – the community of Notepad++ users. This isn’t the feature-request/bug-report tracker (see the FAQ for that).
Your application didn’t work with Notepad++, so I provided some potential workarounds.
As another alternate workaround, instead of the portable Notepad++, create a shell script / batch file, and use that as the editor asscoiated with
arc diff. The script would need to look something like the following
@echo off rem backup the config files copy "%AppData%\Notepad++\config.xml" "%AppData%\Notepad++\config.xml.arcdiffbak" copy "%AppData%\Notepad++\session.xml" "%AppData%\Notepad++\session.xml.arcdiffbak" rem run notepad++ for the commit message rem this is a blocking-instance, so the commit will wait for this instance of notepad++ to be exited "c:\program files (x86)\notepad++\notepad++.exe" -multiInst -nosession %* rem restore the config files copy "%AppData%\Notepad++\config.xml.arcdiffbak" "%AppData%\Notepad++\config.xml" copy "%AppData%\Notepad++\session.xml.arcdiffbak" "%AppData%\Notepad++\session.xml"
This creates a backup of your current config, runs notepad++; then, when you close notepad++, it will copy the backup config back.
I just used my command-line version of TortoiseSVN (which, like your Arcanist User Guide, wants an editor in blocking mode), and verified that the script above will properly be in blocking mode, and will make sure that it restores config.xml and session.xml to the pre-existing version once the temporary instance of Notepad++ is done.
PS: and thanks for prompting me to create that batch file… I’d not known (or forgotten) that the
-multiInst -nosessionput Notepad++ into blocking mode, so I hadn’t set Notepad++ as the editor for SVN; because of this, I am now able to. :-)
Thanks for the bat script suggestion.
I will have a look at that as an alternative. If I can’t get that working I will probably stick with the 2 notepad++ installations
It looks like there are multiple issues raised in github for this by the way (https://github.com/notepad-plus-plus/notepad-plus-plus/issues/4648) so we may get a permanent fix for it.
I got caught up in this unexpected behavior, too.
For me, the steps were:
I use git on Windows, and the recommended solution for making git work with Notepad++ is:
$ git config core.editor
‘C:\Program Files (x86)\Notepad++\notepad++.exe’ -multiInst -notabbar -nosession -noPlugin
I would keep Notepad++ open all the time with multiple unsaved .txt files. I love this feature, that I can use Notepad++ as a scratch workspace, and that my session and edited text files are always backed up and can be restored in case of some sudden Windows crash or restart. It’s the #1 feature of Notepad++ to me.
Something would cause me to close Notepad++, like restarting Windows or having a mandatory Windows update that forcibly closed all apps.
Upon restarting Notepad++, my session was gone and the “Enable session snapshot and periodic backup” setting was cleared. I would have to find where Notepad++ was keeping my backups and I would carefully restore my session by hand. This would make me want to give up on Notepad++ and stop recommending it to others.
So, before giving up for good, I’m glad I found this thread. Unknowingly to me, the “Enable session snapshot and periodic backup” setting was getting cleared by using git.
- What if the -nosession flag caused the “Enable session snapshot and periodic backup” user preference to be disabled in the Preferences dialog box, and that this preference would not be persisted by this instance of Notepad++ (thus preserving the original value in the persisted user settings file)? OR
- What if the -nosession flag did not save user settings at all and the user preferences dialog was disabled? OR
- What if the -nosession flag caused a special no-session set of settings to be saved/loaded to/from a special “no-settings” user settings file?
With the way things are now, as I see it, no one should use Notepad++ with git.
welcome to the notepad++ community, @Ron-Little
as -multiinst and -nosession is incompatible with session snapshots and periodic backups, the best practice is, to keep your installed notepad++ as it is, and to use a secondary portable notepad++ for git.
download the notepad++ 7.6.6. portable version from >>> here <<<.
(the portable version does not require any installation and runs completely independent and isolated from your installed version. all custom settings, as well as any stuff you might want to try at the portable version, will not modify your installed version)
C:\PortableApps\Notepad++folder and start this portable version by double-clicking on
notepad++.exeinside this folder.
make all settings you need at this portable version.
‘C:\PortableApps\Notepad++\notepad++.exe’ -multiInst -notabbar -nosession -noPluginas your command line.
this way your installed notepad++ never gets touched, as the additional portable version is completely self contained.
@Meta-Chuh Thank you for the work-around of using a portable notepad++ for git. I would expect that to work, but I haven’t tested that, as I had already switched to using Notepad.exe for git.
I have had this problem for quite some time but have never bothered to go after it.
Today, after once again losing a few scratch texts because of this ongoing issue, I have found this thread and also a few related open issues on Notepad++ Issues tracker:
- Issue: Default session’s unsaved files are lost (from session’s XML file) after closing Notepad++ in a different session
- ‘enable session snapshot’ gets disabled occasionally
- Saved Sessions lost
- Notepad++ resets my auto-backup setting after I perform a git commit with it.
- Backup is broken in several ways with multiple instances
This is particularly unfortunate because Git installer for Windows itself actually offers to set up Notepad++ as the default editor for commits.
Setting up a portable version just for this seems a bit too much, also it would then be annoying to manually keep both Notepad++ configurations in sync. It is sad, but I have decided to do the same as @Ron-Little and simply use Windows’ Notepad.exe for Git and avoid this problem altogether.