Reopen Notepad++ after update, restart or shutdown Windows 10 from where I was

  • hello. I wanna keep open notepad++ after after update, restart or shutdown Windows 10. With all tabs, all session as it was before. How can I do this?

  • something like, Pick Up where I left off

  • @Vasile-Caraus

    I assume I’m missing something obvious but isn’t this done by activating
    Settings->Preferences->Backup and checking Remember current session for next launch?

  • That used to be the case but since the last Notepad++ update that isn’t happening. It will remember the last session when manually shutdown but not if Windows was shut down.

    I think I’ve also had a couple of situations where it just closed all its files. At work there’s a particular file I like to keep open all the time and since the last update I’ve found that it’s been closed without any other evidence of Windows having restarted.

    So I think something has become broken in the ‘session resume’ logic.

  • @Andrue-Cope said in Reopen Notepad++ after update, restart or shutdown Windows 10 from where I was:

    since the last Notepad++ update

    By that do you mean the last auto-triggered Notepad++ update? or the last time you happened to choose ? > Update Notepad++? or the last Notepad++ version that was released on the official website? Or the most recent update that was released on some non-affiliated download site? Because those are possibly (probably?) separate versions. The auto-update is often 2+ weeks behind the release on the official website. Giving actual version number is the only meaningful phrasing when reporting a regression/bug/behavior-change. The best thing to do is go to ? > Debug Info > Copy debug info into clipboard and paste the results in your reply: this way there is no ambiguity.

    It will remember the last session when manually shutdown but not if Windows was shut down.

    What do you mean by that? Do you mean that if you close Notepad++, then shut down windows, the next time Notepad++ launches, it doesn’t remember? Or do you mean if Windows shuts down cleanly while Notepad++ is still running, then the next time Notepad++ launches it doesn’t remember your session? Or do you mean if Windows crashes while Notepad++ is still running, then the next time Notepad++ launches that it doesn’t remember your session?

    Also, what are your Settings > Preferences > Backup settings?

  • I have the same issue…

    I mean if Windows shuts down cleanly while Notepad++ is still running, then the next time Notepad++ launches it doesn’t remember my open-tabs …

    I am using Windows 10 ver. 1903 and NP++ ver. 7.8.1

  • Actually I found there is a similar issue to Microsoft Visual Studio Code…
    If I shut down Windows while MS-VSC is still running, the next time MS-VSC launches it just remember the previous open-tabs (which MS-VSC closed by myself), not the last open-tabs…

    So, there might be an authority-issue of Windows 10 to access some session directories when we shut down Windows 10 …

  • In theory, shutting down windows and having application saving their settings, does work BUT only if there is enough time left to do so.
    What happens on a windows shutdown is that windows sends a WM_QUERYENDSESSION message to all running programs.
    As we see here, npp handles this case.
    Now the application has 5 seconds to handle this request, if it can’t it will be terminate.
    So, there is no guarantee that a clean application shutdown can be proceeded on a windows shutdown therefore my recommendation would be to exit your application explicitly.

  • @PeterJones Sorry. It happens with 7.7.1. My backup settings are to remember the current session as they have been for several years now. It used to work very reliably. I use Notepad++ for my todo list and for a couple of text files I know I need every day.

    Exactly when it became unreliable or why I’m not sure unfortunately. All I can say is ‘sometime in the last few months’. It might be when Windows is shutdown because of a forced update. Closing Notepad++ is fine. Shutting down Windows manually appears to be fine.

  • @Andrue-Cope

    if it used to work previously, did you change something?
    Like installing other plugins or formerly you used to use local files and
    now you are using files on the network? Something else?
    If it is a forced shutdown, it might be that npp has only 1 second left to do its config saving.
    However, my recommendation stays, close your apps explicitly if possible.

  • Something has surely changed. I had the same issue, but I think I managed to solve it. My N++ was always downloaded as standalone and saved in a custom path. Recently auto-updater kicked in and I allowed the installer to run, but I changed install path to my custom path. This is when restoring session stopped working. Today I downloaded a standalone version and overwrote the installed one. I tried once and session was recovered after closing.

    Maybe this brings a hint or something.

  • the new version, seems to solved the ȚsessionȚ problems. Thank you.

  • On Friday I discovered part of the problem. I started shutting down my computer prior to leaving work and shutdown was blocked by several applications including Notepad++. When I cancelled shutdown I discovered that Notepad++ was prompting me to reload a file that had changed earlier in the day - in fact the one I like to keep open.

    So I clicked ‘Yes’ to tell it to reload the changed file. What actually happened was that the tab closed, leaving just one other tab.

    And of course when I reloaded Notepad++ today only that other tab has loaded.

    This scenario could be quite common. I’m a programmer and the file I like to keep open will often change as I change branches during the day but I don’t always notice.

    This is with 7.8.1.

  • @Andrue-Cope I have the session issue with 7.8.1. In the past if my laptop refused to wake up from sleep mode, a power cycle did not affect the session at all… all open files, all changed files, all “new” files would come back up right where I left them. Now, changes are lost as are new files. I hope there is a fix for this as it is one of my favorite features (out of many) of Npp.

  • @Greg-Parrott
    Sorry, but this doesn’t make sense to me.
    Npp writes the new session information on application exit and this
    has been since it was introduced, as far as I know.

    So, when putting a laptop in standby it will comeback with the current
    used files on a normal wake up but it won’t comeback with the newly
    added files on a power cycle as it hasn’t been written those new files to
    session.xml yet. The same might happen if npp gets forced to exit.
    If there is no time to write to session.xml those new files get lost.

    The only way to make it work, to have the newly created files get saved
    in session.xml always, would be to add them whenever one creates a
    new one or opens an existing one. But this, obviously, has a drawback
    as well, the session.xml would get written constantly and in terms of
    performance, IO operations are one of the worst things, not to
    mention that maybe 99% of those operations might be useless as the
    files get closed during runtime.

  • Well I think what I’ve seen is a bug. If I’m asked ‘Do you want to reload the file?’ and I click [Yes] then that’s what it should do whereas it actually closed the tab. I’ll try and replicate it tomorrow as Friday night is when I normally give my work machine a rest.

  • @Andrue-Cope

    Just to be sure, 100% agreed - your case, "Do you … ", should be handled having those open tabs in mind.

  • @Ekopalypse Thanks for the reply. I just did a little controlled experiment and I see where the “new” behavior may be.

    With my saved list of opened files… the ones I really care about… loaded. I created a new file with junk in it and left it unsaved. I created a second file, saved it, and then added some changes and left it that way. Then I closed NPP.

    Past behaviour would be NPP would exit without any further input. Restarting NPP would open my session where it left off with saved files, new unsaved files, and changed files retaining their changes. This is what I am accustomed to.

    However, with this last update, I now get a question asking if I want to save each file “needing” a save. I want the state saved, but I don’t necessarily want them written to disk by the filename or “New x”. So what I am seeing is different from what Andrue is seeing.

    I may try to roll back this update if I can still get the older executables.

  • @Greg-Parrott

    I guess I see. What I assume is that the session setting isn’t set anymore.
    As far as I remember this setting was set with previous npp versions automatically but since some recent versions the community asked to change this to not set.
    In order to get the same behavior as with your previous version you need to goto
    Settings->preferences->Backup and tick
    Remember current session …
    and if new, aka unsaved files, should also be available tick
    Enable session snapshot …

  • That did it. I needed enable session snapshot. That one setting was all I needed… darn lost a days work because of that. Thanks @Ekopalypse.

Log in to reply