Recent

Author Topic: remove outosave after compilation  (Read 4027 times)

Paolo

  • Sr. Member
  • ****
  • Posts: 499
remove outosave after compilation
« on: July 18, 2021, 07:48:04 pm »
How to remove the autosave of edited files after compilation ?

LAZARUS 2.0.12, windows 10 pro 64-bit

thank you
« Last Edit: September 23, 2021, 06:23:19 pm by Paolo »

Paolo

  • Sr. Member
  • ****
  • Posts: 499
Re: remove outosave after compilation
« Reply #1 on: September 23, 2021, 06:24:04 pm »
no way to remove autosave ?

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: remove outosave after compilation
« Reply #2 on: September 23, 2021, 06:30:11 pm »
The Lazarus IDE saves the files before compilation.
The compiler only has access to the files of the project, not to the text in the source editor of the IDE (which for all intents and purposes only resides in memory).

Bart

Paolo

  • Sr. Member
  • ****
  • Posts: 499
Re: remove outosave after compilation
« Reply #3 on: September 23, 2021, 06:35:25 pm »
ok, but what I see is that if I change the code, do a run and then close file the change is written in the pas file. But my intent was just to try the effect of code modification without change the file. How can I do this ?

Paolo

  • Sr. Member
  • ****
  • Posts: 499
Re: remove outosave after compilation
« Reply #4 on: September 23, 2021, 06:43:37 pm »
In delphi I can do a whole working session and do several runs and several code modifications, then when I close the project and not saving any files all come back to the initial status.

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: remove outosave after compilation
« Reply #5 on: September 23, 2021, 11:19:38 pm »
In Lazarus you cannot.
Live with it (or use Delphi).

Bart

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: remove outosave after compilation
« Reply #6 on: September 23, 2021, 11:35:18 pm »
In Lazarus you cannot.
Live with it (or use Delphi).

Bart


Hi!

There is always a way:

Kill Lazarus with SIGKILL (9)

Not a nice way but it works.

Winni

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: remove outosave after compilation
« Reply #7 on: September 23, 2021, 11:43:50 pm »
Use a version control system like git or svn.

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: remove outosave after compilation
« Reply #8 on: September 23, 2021, 11:54:50 pm »
There is always a way:

Kill Lazarus with SIGKILL (9)

How is that going to achieve what Paolo wants:
- compile the changed but yet unsaved sourcecode
- do not save the source files before compilation

The compiler simply cannot use the changed sourcecode if it is not saved to file.

Bart

Paolo

  • Sr. Member
  • ****
  • Posts: 499
Re: remove outosave after compilation
« Reply #9 on: September 25, 2021, 12:54:59 am »
OK, thanks Bart, so it is not possible.

just a note: I found this a little annoying and dangerous, If I type something just to test and then I want come back I have to remember what has to be reverted (but even in case I did a wrong input in the code then it is saved !).  don't know how delphi works, it probably creates some backups, so until you explicitly do a save, closing the project leaves the project unchanged.

@wp, never used git or svn, maybe it is time to look at them

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: remove autosave after compilation
« Reply #10 on: September 25, 2021, 01:49:30 am »
Well its not "not possible".
It is not possible with the current IDE.

But it could be added....
It would need some implementation (new featuer in the IDE), and that needs someone to do it....

Because fpc is a separate exe, it can not access the memory of the IDE. So it want know the content of any editor.

For compiling the current content of the file must be on some media (disk/volume).
And not just the current files, but all files in any uses clause.
And all files of the project must be in the expected folder structure (usually all units in the same folder / ignore packages for now).

So the ways that this could be implemented are:

1)
- The IDE creates backups of all files
- Saves the files
- compiles
- restores the backups

That is flawed, if the IDE hits file system permissions. And it can change timestamps, upsetting revision management tools

2)
- The IDE saves all files to a temporary location
- The files are compiled in that temp location.

For that the IDE must be informed of all files.
If there are files that the IDE does not know, then they will not be in the temp dir, and the compile fails.

---
Either way, it needs to be implemented.



JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: remove outosave after compilation
« Reply #11 on: September 25, 2021, 02:21:14 am »
Use Undo (Ctrl-Z). You can Undo changes in a saved file, too. Hit Ctrl-Z enough many times and you get the original contents.
Delphi IDE includes the compiler and thus can compile a file already loaded into memory.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: remove outosave after compilation
« Reply #12 on: September 25, 2021, 02:37:03 am »
I always save a local and/or github build version before tinkering with the code. I guess that is pretty much what wp says.
« Last Edit: September 25, 2021, 03:35:17 am by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

Paolo

  • Sr. Member
  • ****
  • Posts: 499
Re: remove outosave after compilation
« Reply #13 on: September 25, 2021, 01:19:58 pm »
thanks to All !

at the moment  I'll follow the Juha suggestion that I did not think about  :-[.

@VTwin I usually do frequent backups, my projects have few units that makes the things easy, so I can always compare what I have changed in case of problem.

@Martin_fr I understood that it is not easy to implement such beahaviour.

thanks to all for the suggestions


 

TinyPortal © 2005-2018