Sign in Join

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

Mailing lists / lazarus / 2020-11

Default project ?

22 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

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

Michael Van Canneyt

Hi,

Is there a way to change the default project generated when the IDE starts ?

If you tell the IDE not to reload the last project when starting, it creates a default GUI application. Since 99,99% of my programs are console programs, I looked for a setting to change this, but did not find one.

If there is none, is it possible to add such a setting (I imagine yes :)) ?

If so, should I post a feature request ?

Michael.

Reply by email

Bart
to Michael Van Canneyt
AM Michael Van Canneyt wrote
If you tell the IDE not to reload the last project when starting, it creates a default GUI application. Since 99,99% of my programs are console programs,

And it would be nice if you could define default compiler settings for console programs that differ from those used for GUI applications. ATM my debug settings for GUI applications depend on the LazUtils package, so that won't (be default) compile with console programs.

Bart

Reply by email

Ondrej Pokorny
to Bart
Bart wrote 9 lines
On Wed, Nov 18, 2020 at 8:43 AM Michael Van Canneyt via lazarus wrote: > If you tell the IDE not to reload the last project when starting, it creates > a default GUI application. Since 99,99% of my programs are console programs, And it would be nice if you could define default compiler settings for console programs that differ from those used for GUI applications. ATM my debug settings for GUI applications depend on the LazUtils package, so that won't (be default) compile with console programs.

IMO better would be to have compiler settings presets (=named list). Then, of course, it's easy to implement to be able to pick up the default settings for each project type from the presets list.

Also, I am bugged by the fact that I cannot delete the (currently global) default compiler settings that I once set.

Ondrej

Reply by email

Michael Van Canneyt
to Bart: On Wed, Nov 18, 2020 at 8:43 AM Michael Van Canneyt via lazarus And it would be nice if…
Bart wrote 10 lines
On Wed, Nov 18, 2020 at 8:43 AM Michael Van Canneyt via lazarus wrote: > If you tell the IDE not to reload the last project when starting, it creates > a default GUI application. Since 99,99% of my programs are console programs, And it would be nice if you could define default compiler settings for console programs that differ from those used for GUI applications. ATM my debug settings for GUI applications depend on the LazUtils package, so that won't (be default) compile with console programs.

I'm curious: How can settings depend on a package for your program ?

Michael.

Reply by email

Bo Berglund
to Michael Van Canneyt: Is there a way to change the default project generated when the IDE starts ? If you tell…
Michael Van Canneyt wrote
Is there a way to change the default project generated when the IDE starts ?

Why is Lazarus creating an empty project on startup in the first place?

I would like to suggest that they take that default project on startup away and start Lazarus without a project so the user can decide to either load an earlier worked on project or create a new project of the exact kind he wants to work with.

Of course there should be a setting to tell Lazarus to start with the latest project reloaded, like it does now.

Delphi has a command line option (-np) to not load the latest project on startup (defaults to load) and when used then it starts without a loaded project. Why change this behaviour?

Especially since Lazarus crashes greatly if there is a problem with the last project and then it takes a detective to make it return to usable again since just restarting causes the same crash to occur again and again.
Happened to me many times....

Please introduce the command line switch -np like in Delphi or make it a config item.

Bo Berglund Developer in Sweden

Reply by email

Michael Van Canneyt
to Bo Berglund
Bo Berglund wrote 7 lines
On Wed, 18 Nov 2020 08:43:00 +0100 (CET), Michael Van Canneyt via lazarus wrote: > Is there a way to change the default project generated when the IDE starts ? Why is Lazarus creating an empty project on startup in the first place?

Because it needs a project. It cannot work without one, so it creates one.

So if the hypothetical option -np would be implemented, you would definitely be presented with the same 'project wizard' dialog you get when you close the project with "Project - Close Project".

Michael.

Reply by email

Bo Berglund
to Michael Van Canneyt
Michael Van Canneyt wrote 18 lines
On Wed, 18 Nov 2020, Bo Berglund via lazarus wrote: > On Wed, 18 Nov 2020 08:43:00 +0100 (CET), Michael Van Canneyt via > lazarus wrote: > >> Is there a way to change the default project generated when the IDE starts ? > > Why is Lazarus creating an empty project on startup in the first > place? Because it needs a project. It cannot work without one, so it creates one. So if the hypothetical option -np would be implemented, you would definitely be presented with the same 'project wizard' dialog you get when you close the project with "Project - Close Project".

OK, so if the last project opened is seriously flawed (for this Lazarus) and crashes Lazarus, how can one ever remedy that?

In my case it has happened when I open an existing project in a new Lazarus installation without realizing that not all packages have been installed into Lazarus.
Then it crashes and now I have no way to start Lazarus without it also opening the project that causes the crash. Eternal loop...

So I cannot even get the access needed to install the needed package(s) (in this case it would be a package that requires a Lazarus rebuild)...

It makes no sense to me to not at least (with a start argument?) be able to start Lazarus with a default project rather than the last loaded project which always crashes Lazarus.

Bo Berglund Developer in Sweden

Reply by email

Michael Van Canneyt
to Bo Berglund
Bo Berglund wrote 10 lines
> > Because it needs a project. It cannot work without one, so it creates one. > > So if the hypothetical option -np would be implemented, you would definitely be > presented with the same 'project wizard' dialog you get when you close the project > with "Project - Close Project". > OK, so if the last project opened is seriously flawed (for this Lazarus) and crashes Lazarus, how can one ever remedy that?

At this moment not without changing the config files manually, I think.

But you could have a command-line option that allows to start Lazarus simply with an empty project instead of the last one.

And that 'empty project' is what I want to have configurable... :-)

Michael.

Reply by email

Bo Berglund
to Michael Van Canneyt
Michael Van Canneyt wrote 22 lines
On Wed, 18 Nov 2020, Bo Berglund via lazarus wrote: >> >> Because it needs a project. It cannot work without one, so it creates one. >> >> So if the hypothetical option -np would be implemented, you would definitely be >> presented with the same 'project wizard' dialog you get when you close the project >> with "Project - Close Project". >> > > OK, so if the last project opened is seriously flawed (for this > Lazarus) and crashes Lazarus, how can one ever remedy that? At this moment not without changing the config files manually, I think. But you could have a command-line option that allows to start Lazarus simply with an empty project instead of the last one. And that 'empty project' is what I want to have configurable... :-)

So, what is that command-line option then?

Do I first need to create an empty project, which can be thrown at Lazarus on startup?
Or is there a command line option like Delphi's -np also for Lazarus that I have missed?

I pretty often install Lazarus/Fpc on new devices (often Raspberry Pi units) so I will now and then hit this problem if I forget to reconfigure base Lazarus with the packages I usually need.

Bo Berglund Developer in Sweden

Reply by email

John Landmesser
to Bo Berglund
Bo Berglund wrote 5 lines
Especially since Lazarus crashes greatly if there is a problem with the last project and then it takes a detective to make it return to usable again since just restarting causes the same crash to occur again and again. Happened to me many times.....

Use your filemanager to open the last working(!!) *.lpi ... rightclick ... open with ...

Reply by email

Mattias Gaertner
to Bo Berglund: On Wed, 18 Nov 2020 20:08:14 +0100 (CET), Michael Van Canneyt via OK, so if the last…
Show quoted text 9 lines
[...] OK, so if the last project opened is seriously flawed (for this Lazarus) and crashes Lazarus, how can one ever remedy that? In my case it has happened when I open an existing project in a new Lazarus installation without realizing that not all packages have been installed into Lazarus. Then it crashes and now I have no way to start Lazarus without it also opening the project that causes the crash. Eternal loop...

That's strange, because Lazarus has a startprotocol. If the last project crashed the IDE, next time it will ask if it should open the project.

How do you start Lazarus?

Mattias

Reply by email

Bo Berglund
to Mattias Gaertner: On Wed, 18 Nov 2020 20:43:33 +0100 That's strange, because Lazarus has a startprotocol.…
Mattias Gaertner wrote 6 lines
That's strange, because Lazarus has a startprotocol. If the last project crashed the IDE, next time it will ask if it should open the project. How do you start Lazarus?

I have desktop files in:
~/.local/share/applications/

These typically contains this (for the latest version I have), notice that my newsreader is autowrapping the Exec line:

File lazarus_2.0.10.desktop:

[Desktop Entry]
Comment=Lazarus IDE 2.0.10
Terminal=false
Name=Lazarus 2.0.10
Exec=/home/pi/dev/lazarus/2.0.10/startlazarus
--pcp=/home/pi/.lazarus_2.0.10 %f
Type=Application
Icon=/home/pi/dev/lazarus/2.0.10/images/ide_icon48x48.png Categories=Application;IDE;Development;GTK;GUIDesigner;Programming; NoDisplay=false
Keywords=editor;Pascal;IDE;FreePascal;fpc;Design;Designer;

Bo Berglund Developer in Sweden

Reply by email

Martin Frb
to Bo Berglund: On Wed, 18 Nov 2020 08:43:00 +0100 (CET), Michael Van Canneyt via Why is Lazarus creating…
Bo Berglund wrote 6 lines
Especially since Lazarus crashes greatly if there is a problem with the last project and then it takes a detective to make it return to usable again since just restarting causes the same crash to occur again and again. Happened to me many times....

Lazarus is supposed to detect, if it crashed during the last startup while opening the project. And at least in the few cases where I had such crashes, the next start of the IDE has always prompt me, if I want to open that project, or start with an empty one.

So if the repeated crash happens to you, then you are hitting 2 bugs at once. And it would be really good if they could be reported in a reproducible manner.

Btw, as a workaround (just thinking about): Move the project to a different folder (just to start the IDE). If it can not be found, it can not be opened, it can not crash.
=> Of course that does not solve the problem that eventually you do want to open the project. But that is also not remedied by the IDE starting with no project at all ( -np ).

Reply by email

Bo Berglund
to Mattias Gaertner: On Wed, 18 Nov 2020 21:31:44 +0100 lazarus.exe -h --skip-last-project Mattias
Mattias Gaertner wrote
> Or is there a command line option like Delphi's -np also for Lazarus > that I have missed? --skip-last-project

Perfect, that is what I would need then!
Starts Lazarus with an empty default project.
Almost the same as Delphi's -np given that Lazarus needs a project to work.

Then Project/Open Recent Project to select what if anything I need to re-open.

Follow-up:
Is there a way to configure the number of projects saved to this list? Right now it seems to only hold 5 projects...

Bo Berglund Developer in Sweden

Reply by email

Bo Berglund
to Bo Berglund
Bo Berglund wrote
Follow-up: Is there a way to configure the number of projects saved to this list? Right now it seems to only hold 5 projects...

Of course:
Tools/Options/Environment/Files

Sorry for that question.

Bo Berglund Developer in Sweden

Reply by email

Juha Manninen
to Bo Berglund: On Wed, 18 Nov 2020 08:43:00 +0100 (CET), Michael Van Canneyt via Why is Lazarus creating…

On Wed, Nov 18, 2020 at 8:51 PM Bo Berglund via lazarus <

Show quoted text 5 lines
wrote: Especially since Lazarus crashes greatly if there is a problem with the last project ...

Report all such crashes please. Test with Lazarus trunk and include a minimal test project to reproduce.

Juha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20201119/c92f8a34/attachment.html>

Reply by email

Bo Berglund
to Bart: Can we now get back to the original question this thread was about? Bart
Bart wrote
Can we now get back to the original question this thread was about?

I agree that it would be nice to have a setting in Lazarus to define *what type of project* it will autogenerate in absence of a previous project to load.

But it is not that difficult really to configure Lazarus to not load the previous project and then when the default pops up go to Project/New... and select the wanted type.
So a setting for "Default project type" might help...

The issue here might be to avoid loading a massive project un-necessarily when one wants to start a new project.

If the checkbox at
Tools/Options/Environment/Open_Last_Project_And_Packages_At_Start

is unchecked it acts the same as if the start command contains the argument --skip-last-project, so it is easier to manage this way.

Bo Berglund Developer in Sweden

Reply by email

Michael Van Canneyt
to Bo Berglund
Bo Berglund wrote 23 lines
On Thu, 19 Nov 2020 12:17:11 +0100, Bart via lazarus wrote: > Can we now get back to the original question this thread was about? > I agree that it would be nice to have a setting in Lazarus to define *what type of project* it will autogenerate in absence of a previous project to load. But it is not that difficult really to configure Lazarus to not load the previous project and then when the default pops up go to Project/New... and select the wanted type. So a setting for "Default project type" might help... The issue here might be to avoid loading a massive project un-necessarily when one wants to start a new project. If the checkbox at Tools/Options/Environment/Open_Last_Project_And_Packages_At_Start is unchecked it acts the same as if the start command contains the argument --skip-last-project, so it is easier to manage this way.

No, I want it actually to create a 'Simple program' as that is what I do in 90% of cases. The 9 other percent is 'Console application' and maybe 1% 'Application' (the current default).

I'll post a feature request in the bugtracker.

Michael.

Reply by email