Re: [Lazarus] AutoSave does not save project file...
On Thu, 20 May 2021 21:10:10 +0200, Bo Berglund via lazarus wrote: >On Sun, 11 Apr 2021 11:29:36 +0200, Bo Berglund via lazarus > wrote: > >>I have installed AutoSave from the OnlinePackageManager on all of my numerous >>Lazarus installations and in general it works well. >>I started to do this following several Lazarus crashes where I lost modified >>code and had to try restoring from memory... >> >>However, when I write console (simple program) applications I have noted that >>AutoSave does not save the lpr file! And when looking closely the lpi file in >>GUI apps is also not saved. >> >>Since lpr is the only file in simple programs AutoSave does not help from >>disaster if a crash happens. >>Is there a way to configure or modify AutoSave so it also saves the main >>project >>files? >> > >Reviving this thread in order to find a solution (did not get a single reply). >-- >I am relying heavily on AutoSave when programming in Lazarus on a remote >RaspberryPi via VNC connection. In this situation it happens way too often that >Lazarus suddenly just unloads from memory and I see a blank desktop. >Thanks to AutoSave in most cases I have just to start Lazarus again to be back >in business, at worst with the last 5 seconds of typing lost. > >But that does not hold true if I am working in the lpr file because that is not >saved automatically!!! > >It just happened to me again and it causes problems trying to re-create the >last >hour or so of work done on this file. :( > >So I would REALLY be happy if someone who understands the workings of AutoSave >can make it include the project file among the files saved by AutoSave! > >I have never ever looked at stuff that integrate within Lazarus itself so I >could not fix it Now I have looked at the GitHub code, but am none the wiser (or a little bit wiser)... >For a console program maybe I should create a mainprogram.pas file and put >*everything* now located in the lpr file into that instead? >Just leave a bare minimum in the lpr file... >Pity to be forced to do that though. > As Juha Manninen suggested I have looked at the Autosave code in GitHub and I found this to be where the action is triggered: The file is: https://github.com/lainz/LazAutoSave/blob/master/autosave_main.pas And this is the function that does the job (starts at line #107): procedure TAutoSave.OnTimer(Sender: TObject); begin if Settings = nil then begin if LazarusIDE <> nil then //wait until IDE startup begin Settings := TSettings.Create(AppendPathDelim(LazarusIDE.GetPrimaryConfigPath) + cAutoSaveConfigFile); FTimer.StopTimer; FTimer.Interval := Settings.AutoSaveInteval*1000; FTimer.StartTimer; end; end else begin if Settings.EnableAutoSave then LazarusIDE.DoSaveAll([sfDoNotSaveVirtualFiles, sfCanAbort, sfQuietUnitCheck]); //<== Does *not* save the project lpr file! end; end; Notice that it calls LazarusIDE itself and I have no idea how to make Lazarus include the lpr file into the ones being saved by this call... There *must* be some setting for this in Lazarus, right? So how can I tell Lazarus to include the lpr file in the saved files when it is called this way? I am still experiencing these regular crashes in Lazarus even when using the version 2.2.6 with Fpc 3.2.2 on a RaspberryPi4B 8GB device. I access the desktop with VNC, which may be why the crash happens. Typically Lazarus disappears when I accidentally click the mouse on something in the IDE, but I don't understand exactly what is clicked. Could be some border in the editor or such, but Lazarus instantly disappears and I look at a blank desktop... However, Autosave has saved the day for me because when it happens I can just start Lazarus again and I am back where I left off. Except of course if I am doing a command line program with all code in the lpr file, then everything is lost when the crash happens. -- Bo Berglund Developer in Sweden -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] AutoSave does not save project file...
On Thu, Jun 10, 2021 at 4:48 PM Bo Berglund via lazarus < lazarus@lists.lazarus-ide.org> wrote: > I have never ever looked at stuff that integrate within Lazarus itself so I > could not fix it > Maybe it is time you look at such stuff. It may be an easy bug. A list of file endings missing .lpr maybe. DebugLn() lines are a good way to debug code which is part of the Lazarus IDE. This bug is not my "itch to scratch". Apparently it is yours. Please tell us what you find by debugging. Other people may get inspired to study the issue once you show you really tried to solve it. This is FOSS development, you know ... Regards, Juha -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] AutoSave does not save project file...
On Sun, 11 Apr 2021 11:29:36 +0200, Bo Berglund via lazarus wrote: >I have installed AutoSave from the OnlinePackageManager on all of my numerous >Lazarus installations and in general it works well. >I started to do this following several Lazarus crashes where I lost modified >code and had to try restoring from memory... > >However, when I write console (simple program) applications I have noted that >AutoSave does not save the lpr file! And when looking closely the lpi file in >GUI apps is also not saved. > >Since lpr is the only file in simple programs AutoSave does not help from >disaster if a crash happens. >Is there a way to configure or modify AutoSave so it also saves the main >project >files? > Reviving this thread in order to find a solution (did not get a single reply). -- I am relying heavily on AutoSave when programming in Lazarus on a remote RaspberryPi via VNC connection. In this situation it happens way too often that Lazarus suddenly just unloads from memory and I see a blank desktop. Thanks to AutoSave in most cases I have just to start Lazarus again to be back in business, at worst with the last 5 seconds of typing lost. But that does not hold true if I am working in the lpr file because that is not saved automatically!!! It just happened to me again and it causes problems trying to re-create the last hour or so of work done on this file. :( So I would REALLY be happy if someone who understands the workings of AutoSave can make it include the project file among the files saved by AutoSave! I have never ever looked at stuff that integrate within Lazarus itself so I could not fix it For a console program maybe I should create a mainprogram.pas file and put *everything* now located in the lpr file into that instead? Just leave a bare minimum in the lpr file... Pity to be forced to do that though. -- Bo Berglund Developer in Sweden -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] AutoSave does not save project file...
On Sun, 11 Apr 2021 11:29:36 +0200, Bo Berglund via lazarus wrote: >Is there a way to configure or modify AutoSave so it also saves the main >project >files? I looked at the Autosave sources on github and found this in the save timer: procedure TAutoSave.OnTimer(Sender: TObject); begin if Settings = nil then begin if LazarusIDE <> nil then //wait until IDE startup begin Settings := TSettings.Create(AppendPathDelim(LazarusIDE.GetPrimaryConfigPath) + cAutoSaveConfigFile); FTimer.StopTimer; FTimer.Interval := Settings.AutoSaveInteval*1000; FTimer.StartTimer; end; end else begin if Settings.EnableAutoSave then LazarusIDE.DoSaveAll([sfDoNotSaveVirtualFiles, sfCanAbort, sfQuietUnitCheck]); end; end; So it calls LazarusIDE.DoSaveAll, which means that somehow whan DoSaveAll Lazarus itself fails to save the project file itself Can this be fixed? -- Bo Berglund Developer in Sweden -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
[Lazarus] AutoSave does not save project file...
I have installed AutoSave from the OnlinePackageManager on all of my numerous Lazarus installations and in general it works well. I started to do this following several Lazarus crashes where I lost modified code and had to try restoring from memory... However, when I write console (simple program) applications I have noted that AutoSave does not save the lpr file! And when looking closely the lpi file in GUI apps is also not saved. Since lpr is the only file in simple programs AutoSave does not help from disaster if a crash happens. Is there a way to configure or modify AutoSave so it also saves the main project files? -- Bo Berglund Developer in Sweden -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus