Recovering after modified by another program
-
That dialog was the protection against losing data: you are supposed to hit “no” if you do not want your changes overwritten by what is currently on disk. If you did not have a separate backup plan, then the data is likely gone.
Session Snapshot and Periodic backup would not have helped, because as soon as you answered that you wanted to reload the data from disk, it took you at your word; that is now the editor content that it would write into the periodic backup 7 seconds (or whatever you have it set to) after the last time you typed anything into the reloaded file. (If you are still in the rare circumstance of not having typed anything since the file was reloaded from disk, then there is a possibility that your periodic backup directory – probably
%AppData%\Notepad++\backup
🛈 ↗ – has a snapshot from before the reload… but it is not guaranteed). Enabling .bak backups might have helped, depending on the last time you hit save. But since you already indicated it was last saved on January 11th, the .bak would have been that far out of date as well.)I highly recommend taking an active role in your data integrity. Read the backup FAQ in this forum. Implement an external backup plan, and/or make use of version control. Never rely on “I didn’t have to hit save, and it still kept my data before” – the purpose of that feature is not for going for a month or more without hitting save. (I cannot fathom liking such a user experience; no program that I have used has had such a feature, excepting the cloud spreadsheet programs, and those I hate for the lack of “save” buttons… I want to be in charge of my own saves, thank you very much.)
If you want to automate saving of your file, see the Backup FAQ in this Forum, which explains a plugin made for that purpose.
-
@cuchisavila I’ve wanted exactly the same thing. The issue isn’t about data loss for me; it’s about being able to see the previous incarnation if I want to. Using git, for example, often results in touched files (which may or may not have changed) after switching branches. It would be really nice if the reloading of the file were an undoable event.
-
It would be really nice if the reloading of the file were an undoable event.
Hmm… I cannot think of a drawback of making the reload-from-disk be something that you can “undo”.
I mean, there are technical challenges to overcome in order to implement it. (For example, depending on how big the file being edited is, there may not be enough available memory and/or TEMP-directory disk space to hold a copy of the old version so that you can have the copy to “undo” back.)
But having technical challenges doesn’t make it a bad idea … and I can see how being able to “undo” that reload-from-disk could be a data-protection benefit and maybe have other uses than that. (I don’t know why the original post’s use of “undo” didn’t trigger the same thought for me. Sorry.)
If someone were to read the “FAQ: Feature Request” and follow the instructions in there, one could make an official feature request. After the issue is created, it would be nice to paste a link to that issue in reply to this message so we could follow the progress on the request.
-
@peterjones said in Recovering after modified by another program:
Hmm… I cannot think of a drawback of making the reload-from-disk be something that you can “undo”.
Hmmmm, thinking back a bit, wasn’t there a request for allowing undo of the File menu’s Reload command, and it was implemented, but it caused a bunch of problems and was reverted? This current “request” (if that’s what it turns into) seems like it would be a “close cousin” to that earlier change that was tried.
-
I had forgotten about that. Your memory is better than mine.
Searching the old issues, I think #5626 tells the story: after #5141, v7.6.5 added “undo beyond reload-from-disk feature”; then because of bugs/problems like memory overflow in issue #5595 meant that v7.7 removed that feature – “it caused more problems than it was worth”. #5813 is a request to re-add the feature.
So unfortunately for @Leslie-Goldsmith , they aren’t likely to re-implement it, since #5813 has been left languishing for more than two years.
-
Does anyone have a solution for this?
-
@cuchisavila Did you find the solution for this?
-
Because of implementation difficulties, “undo after reload-from-disk” is not something the developers have chosen to implement. Without that feature in the application, then the onus is on the users to keep good version control and backups of files, so that if Notepad++ is unable to undo the “reload from disk”, the user can still go back in their version-control-history to get the version of the file they want.
But in general, it’s a bad idea to be editing a file in Notepad++ when some external application is writing to the file as well (though there are some reasonable uses for reading/viewing a file in Notepad++ while some external application is writing to it).
And it’s very important to pay attention to that “this file had been modified by another program. Do you want to reload it” and only click YES to reload if you really want to lose any changes you had made in your Notepad++ edit.
-
@PeterJones ,
The best example I have for using this feature, is when we use NPP to edit a file for dBASE Plus, that we have open to test changes, sometimes an error comes up in the dBASE Plus IDE environment and offers to allow us to fix the error. It has the line number that it stops at and if we answer “fix” the IDE editor opens up and allows us to make a change at that line. We close the editor and the program continues to run if the error was corrected.When we re-examine or write other code in NPP, we get the option to reload the file because we made changes in the IDE. I like this option, to remind me the file has changed. At first it’s confusing, but that’s what happens when you access the same file by more than one editor and I for one don’t want it to stop that reminder, nor to try and keep the bad code that caused the error by rolling it back.
Moral of the story is “know your tools”. :)
-
Loss of information when someone makes a choice, either Yes or No, to the reload prompt seems to be a common enough issue that developing a fix seems desirable.
One thought is that Notepad++ could store backups in its usual backup folder. The person using Notepad++ would then have some options should they discover that they had lost something.
If someone selects “No” to the reload prompt then make a backup of the file that’s on disk. This preserves a copy just in case the person saves the file they had been working on and then realizes that they wanted something that was in copy of the file they had been offered to reload but had declined.
If someone selects “Yes” to the reload prompt then do a flush of the editor session to the backup file and then reload the file. As soon as they make changes within the editor session of the newly reloaded file then a new back file will be created with an @ time stamp of the current time.
We would then have copies on disk of both the old and new file, regardless of the choice that was made.
Apparently some people really liked the npp v7.6 solution where the undo/redo history buffer was not reset and so that could be made available as an option.
-
Perhaps users think of reload being an undoable action (they probably do because they don’t think of it at all, they just assume that everything is undoable). Perhaps prompting should make note that the choice about to be made is irrevocable.
-
@mkupper ,
The user has that choice, by selecting the appropriateSettings->Preferences->Backup
dialog choices. In particular if they enableVerbose Backup
, they can get to have time stamped backups.In my IDE, situation, anytime a file is changed, the backup is saved, so I have the option already in my IDE to be able to undo the last saved changes. That’s something any computer user needs to learn right off the bat, and coddling neophytes by doing it for them, does not benefit them, in the long run. They would still be oblivious to the realities of computing. In addition, most (and I emphasize, MOST) users of NPP are not that oblivious to computing practices. The ones that are, need to learn, or they will continuer to make mistakes and blame the world and the author of the software.