Recent

Author Topic: Avoid automatic file saving when starting program  (Read 4948 times)

GLR

  • New member
  • *
  • Posts: 8
Avoid automatic file saving when starting program
« on: July 01, 2025, 03:37:54 pm »
Hello!

When I run the program from the IDE, all changed source files are saved automatically. How can I avoid this? Often I have to change back to an earlier version of the source.

I did not find an IDE setting for this need.

GLR

Thaddy

  • Hero Member
  • *****
  • Posts: 18727
  • To Europe: simply sell USA bonds: dollar collapses
Re: Avoid automatic file saving when starting program
« Reply #1 on: July 01, 2025, 03:45:36 pm »
The files are always compiled from disk, not memory. On Windows ctrl-z may help, or repeated ctrl-z's.
So small changes may be corrected. I did not test it on Linux, because there I use a different editor.
(Geany) but that does the same. Also ctrl-z.
But frankly, I do not know the exact undo limit on both platforms.

This works, though, as long as you do not close the ide.
The undo stack IS in memory ( or swap) and won't survive restarts.
« Last Edit: July 01, 2025, 03:56:34 pm by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

GLR

  • New member
  • *
  • Posts: 8
Re: Avoid automatic file saving when starting program
« Reply #2 on: July 01, 2025, 05:15:22 pm »
Thank you for the clarification.

I'm accustomed to another behavior from Delphi (no automatical saving; question to save yes/no before closing); if you have worked with their IDE for decades, it becomes a different deeply rooted routine.

I have to get used to Ctrl+z.

(Nevertheless it would be no bad addition to the Laz options to mirror the Delphi IDE behavior.)

Thaddy

  • Hero Member
  • *****
  • Posts: 18727
  • To Europe: simply sell USA bonds: dollar collapses
Re: Avoid automatic file saving when starting program
« Reply #3 on: July 01, 2025, 05:36:45 pm »
Delphi works EXACTLY the same on large projects, also compiles from disk. Tested 12.1
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

GLR

  • New member
  • *
  • Posts: 8
Re: Avoid automatic file saving when starting program
« Reply #4 on: July 01, 2025, 05:47:11 pm »
I have Delphi 2010.

Under IDE options there are two options for "Auto save":
- Editor files
- Project desktop

If the first is not activated, the files are not saved automatically when running the program. When the IDE ist closed, the question "Save Yes/No" is shown.

If it is activated, the behavior is like Lazarus.

Paolo

  • Hero Member
  • *****
  • Posts: 675
Re: Avoid automatic file saving when starting program
« Reply #5 on: July 01, 2025, 10:49:30 pm »
I agree, the two more annoying thing of IDE coming from delphi:

- the one you described
- the fact that the IDE cannot be opened without open a project.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4671
  • I like bugs.
Re: Avoid automatic file saving when starting program
« Reply #6 on: July 01, 2025, 11:51:59 pm »
(Nevertheless it would be no bad addition to the Laz options to mirror the Delphi IDE behavior.)
It cannot be mirrored because Lazarus uses an external compiler FPC and source files must be saved for it.
Delphi has an integrated compiler and can do it in memory without saving.
After a while this is a non-issue. It is only good that files get saved sometimes in case power goes out or something. And yes, Undo works also after saving.

Quote
- the fact that the IDE cannot be opened without open a project.
Also a non-issue after some getting used to. You can keep a dummy project open and pretend there is no project.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 18727
  • To Europe: simply sell USA bonds: dollar collapses
Re: Avoid automatic file saving when starting program
« Reply #7 on: July 02, 2025, 07:48:51 am »
- Delphi does not have an integrated compiler for all platforms it supports. It does for win32 only afaik.
- The FreePascal textmode IDE has an integrated compiler, so it is not completely unlikely this can be done for Lazarus.
Even better, the Textmode IDE internally supports the platform compiler, so 64 bits 32 bits Unix and Windows depending on build. The compiler interface for the textmode ide is known, so that can possibly be re-used.

(I can't imagine this has not been tried, although I agree with your remark that its usefulness is debatable)
« Last Edit: July 02, 2025, 07:58:42 am by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4671
  • I like bugs.
Re: Avoid automatic file saving when starting program
« Reply #8 on: July 02, 2025, 08:23:46 am »
- The FreePascal textmode IDE has an integrated compiler, so it is not completely unlikely this can be done for Lazarus.
How is it done? The compiler must then be in a form of a library with an API and linked to the IDE.
Actually it is a cool idea, I have thought about it in the past.
Hard drives are fast so the speed difference is small but still exists. Before stating to compile, Lazarus checks some potentially changed files on disk. I don't remember what exactly it checks. Anyway that is a noticeable delay in a slow machine. It would be nice to be close to Delphi's compilation speed which is phenomenal.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 18727
  • To Europe: simply sell USA bonds: dollar collapses
Re: Avoid automatic file saving when starting program
« Reply #9 on: July 02, 2025, 09:16:19 am »
Yes, you can see that when you build it: the compiler is re-compiled and statically linked in fp.
fp does not need a ppcxxxx available nor does it need shared libraries.
This is the case on all the main platforms. See the make file for fp.
Ask the core fpc developers for the ins and outs.

I don't know if it is sufficiently documented,, I just know.

(btw compile speed in Delphi is only superfast for win32. The llvm based compilers speed can compare to fpc already.)
« Last Edit: July 02, 2025, 09:53:14 am by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

Nicole

  • Hero Member
  • *****
  • Posts: 1303
Re: Avoid automatic file saving when starting program
« Reply #10 on: July 02, 2025, 10:13:20 am »
This is indeed in many situations not wanted. I do this: I copy the whole folder, which contains my project with all its stuff including databases. Then I work on. In serval cases I closed Lazarus, renamed the backup copy back to the project-name, re-open Lazarus and worked on with my older version.

From time to time, I delete the stuff not needed any more.

All those tools and repositories are somehow tricky.
I keep coming back to just "hold and may be use it later" for intraday work.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12076
  • Debugger - SynEdit - and more
    • wiki
Re: Avoid automatic file saving when starting program
« Reply #11 on: July 02, 2025, 10:44:21 am »
It's a known issue ... And probably an unsolvable issue (at least for quite some time to come).

Currently the compiler can only compile the files if they are saved. And that wont change anytime soon (nor far).

Files could be saved to an alternative location for compiling. However, that would mean the IDE would have to change any path specified in config or source. As that can be arbitrary complex, this would introduce a massive chance of getting errors. So that is not a good idea.

Files could be saved, and then restored. That would work. Well as long as there are no file-monitoring tools watching, because they would be triggered.

But for now, nothing of that sort exists.



The previous version will be in the backup folder (if you haven't disabled backup saving). So it isn't lost.

But for quick trial and error tests, and keeping your project as it is... There is no simple solution.

Personally, I put projects under revision management (for me git, but svn or others work too). Then I can always revert them to the last commited revision.
Of course, it adds the need for an extra tool...

n7800

  • Hero Member
  • *****
  • Posts: 596
  • Lazarus IDE contributor
    • GitLab profile
Re: Avoid automatic file saving when starting program
« Reply #12 on: July 02, 2025, 10:47:45 am »
Yes, you can see that when you build it: the compiler is re-compiled and statically linked in fp.
fp does not need a ppcxxxx available nor does it need shared libraries.
This is the case on all the main platforms. See the make file for fp.

I didn't know that, interesting idea of ​​"integrated compiler"! Although, I don't know how relevant it is. I always waited for the implementation of the ability to transfer files via pipes, which should be more "portable".

I wonder if it is also possible to "integrate" the compiler into Lazarus, as a package?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12076
  • Debugger - SynEdit - and more
    • wiki
Re: Avoid automatic file saving when starting program
« Reply #13 on: July 02, 2025, 10:59:54 am »
I wonder if it is also possible to "integrate" the compiler into Lazarus, as a package?

In theory.... IIRC it was discussed long ago, but back then not considered for stability. (and IIRC then it also did not always release all memory / but I may remember that wrong).

Calling an external tool avoids such issues. (If indeed they existed)

And if you want cross compiling you would need to add all the targets.
Which by the way wont work for compiling 32bit target on a 64bit host in a 64bit IDE (because there is no such cross compiler / the Lazarus addon is a disguised 32bit ppc, but that can't be linked into a 64bit IDE).

Thaddy

  • Hero Member
  • *****
  • Posts: 18727
  • To Europe: simply sell USA bonds: dollar collapses
Re: Avoid automatic file saving when starting program
« Reply #14 on: July 02, 2025, 11:05:38 am »
I explained the latter limitation. But that is not what the majority of users do: they compile for one platform only. But as I wrote: it is possible.
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

 

TinyPortal © 2005-2018