Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2021-05

Lazarus AutoSave package does not autosave all files....

2 messages · 1 person · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bo Berglund

Is there a way to make AutoSave save also the main project file? I have noted that when I build a more complex program I have an lpr (or dpr for Delphi compatibility) project file but if the project is a simple program the project file becomes a pas file.

In both cases I have found that the AutoSave plug-in (available from OnLine Package Manager) does its job concerning the extra units in the project so when working on these there is regular disk saves happening. Not so with the dpr/lpr files or the pas file which contains the simple program.

Have I missed something here or is there some hidden config which has to be enabled to get it to save ALL files?

Bo Berglund Developer in Sweden

Reply by email

Bo Berglund
to Bo Berglund
Bo Berglund wrote 12 lines
Is there a way to make AutoSave save also the main project file? I have noted that when I build a more complex program I have an lpr (or dpr for Delphi compatibility) project file but if the project is a simple program the project file becomes a pas file. In both cases I have found that the AutoSave plug-in (available from OnLine Package Manager) does its job concerning the extra units in the project so when working on these there is regular disk saves happening. Not so with the dpr/lpr files or the pas file which contains the simple program. Have I missed something here or is there some hidden config which has to be enabled to get it to save ALL files?

So I decided to move "everything" out of the lpr file and put the program itself as a procedure in the new mainprogram.pas file instead. Basically I now have an empty lpr file with this:

program Myprogram;
uses
  {$IFDEF UNIX}
    cthreads,
    baseunix,
  {$ENDIF}
  mainprogram;

{Main program start}

{$R *.res}
begin
  MainProg;
end.

Everything that was in the lpr has moved to mainprogram.pas

Now I have a question regarding uses in the lpr file:

Whenever I create a new unit in Lazarus it puts its name into the lpr file uses clause. Why does it do this? Is it required that all units used by the program must be listed in the lpr file uses clause?

It seems to work anyway, I moved all of the uses from dpr into mainprogram.pas and now Lazarus "Hints" that there are lots of units not used by mainprogram.pas.

Why were these not hinted when they were in the lpr file?

Now at least I am not losing my code edits the next time Lazarus crashes on me...
Autosaved every 5 seconds.

Bo Berglund Developer in Sweden

Reply by email