Аutomatically save project files during compiling lazarus / 9-Editor ---------------------------------------------------------------------- Valentin · 2014-02-09 23:56 Lazarus saves project files during compiling, but it is not convenient in case you decide to exit the project and revert the files. This is what I miss from Delphi editor. ---------------------------------------------------------------------- exdatis · 2014-02-10 06:09 Use Mercurial: http://easyhg.org/ ---------------------------------------------------------------------- JD · 2014-02-10 11:29 Quote from: valyo on February 10, 2014, 12:56:48 amLazarus saves project files during compiling, but it is not convenient in case you decide to exit the project and revert the files. This is what I miss from Delphi editor. Even Delphi introduced subversion in Delphi XE http://www.drbob42.com/examines/examinD3.htm ---------------------------------------------------------------------- hinst · 2014-02-10 12:00 Lazarus has backup feature (I believe it is enabled by default); it creates backup files in backup subdirectory; one can configure backup feature in options dialog window. For example you can chooose to keep 100 backup files so you will have lots of backup files for each file of your project; then you can find old version of file and revert it by copying it from backup folder to project dir However using version control system is probably a better solution. I recommend mercurial because it is easy to use; IMO a lot easier than git or subversion ---------------------------------------------------------------------- JD · 2014-02-10 12:07 Quote from: hinst on February 10, 2014, 01:00:41 pmLazarus has backup feature (I believe it is enabled by default); it creates backup files in backup subdirectory; one can configure backup feature in options dialog window. For example you can chooose to keep 100 backup files so you will have lots of backup files for each file of your project; then you can find old version of file and revert it by copying it from backup folder to project dir However using version control system is probably a better solution. I recommend mercurial because it is easy to use; IMO a lot easier than git or subversion Yep version control is a better idea. I agree with you on Mercurial also. ---------------------------------------------------------------------- Zoran · 2014-02-10 15:01 Quote from: valyo on February 10, 2014, 12:56:48 amLazarus saves project files during compiling, but it is not convenient in case you decide to exit the project and revert the files. This is what I miss from Delphi editor. Pascal compiler is not part of the Lazarus IDE. Lazarus can call compiler only on the files on disk. That is why all files must be saved before compilation. ---------------------------------------------------------------------- Valentin · 2014-02-11 23:52 Quote from: Zoran on February 10, 2014, 04:01:17 pmPascal compiler is not part of the Lazarus IDE. Lazarus can call compiler only on the files on disk. That is why all files must be saved before compilation. It's possible to use a temp files created by lazarus just before comiling, so the original files remain unsaved... ---------------------------------------------------------------------- typo · 2014-02-12 02:53 Mark "Undo After Save" on Tools > Options > Editor > General and simply undo the changes after compiling. ---------------------------------------------------------------------- Martin_fr · 2014-02-12 03:51 Yes it would be possible to save to a temp directory. But nobody has yet implemented it..... A patch would certainly be welcome. But it is not trivial, since files may depend on other files in that directory, so those also need to be saved. All search path must be updated. "Uses Unit1 in FileName1" must be taken care off. Maybe the new dotted unit name also require files in the correct places.... Just copy the backups back. But best is always a local repository (git, svn, anything). And commit often, really often. If something gives trouble 2 month (even years) after you changed it (maybe conflicts with another change you try to make), then you can still have a look at what exactly you changed back then, maybe even roll back the one revision only. And with good log messages you also know why you did it. ---------------------------------------------------------------------- georgebou · 2014-02-19 00:40 A simple solution that could be implemented is the following: Let's suppose we have to compile unit1.pas  a. Copy the original file unit1.pas to a file named unit1.old b. Now change everything you like and experiment on code. c. when you compile the file, the editor saves the file and fpc compiles unit1.pas as it does and now. Now we have 2 options: a. if the user decides not to save the changes, unit1.pas should be deleted and file unit1.old should be renamed to unit1.pas d. if the user decides to save changes, unit1.pas remains as it is and the file unit1.old is deleted. This method doesn't affect dependencies and other things and it's simple. I hope they implement it. ---------------------------------------------------------------------- BjPascal · 2018-07-20 21:57 Now 4 more years have passed, and I wonder: Has anything improved in this matter? At least I haven't found any option pointing in this direction. ---------------------------------------------------------------------- lainz · 2018-07-20 22:22 I have just the opposite thing https://github.com/lainz/LazAutoSave That saves everything automatically each x seconds (if there is something to save). I agree than you should use versioning. But check that code, maybe you can tweak it to do the opposite: prevent saving. I mean make a plugin for the IDE.. I didn't make it fully, I got help from GetMem and JuhaManninen. ---------------------------------------------------------------------- Blaazen · 2018-07-20 22:23 @ Has anything improved in this matter? Nothing, becuase there was no need. There's undo for recent changes and version control systems or older changes.