[Geany-devel] Opening files with command-line

Eugene Arshinov earshinov at xxxxx
Mon Feb 8 17:58:06 UTC 2010


Hi guys. Thank you for the feedback.

On Sun, 07 Feb 2010 20:40:18 +0100%
Colomban Wendling <lists.ban at herbesfolles.org> wrote:

> Hi,
> 
> Enrico Tröger a écrit :
> > On Sun, 7 Feb 2010 12:40:28 +0300, Eugene wrote:
> >
> > Heya,
> >   
> >> 1. If user opens a project, all other filenames passed via
> >> command-line are ignored (see main.c:load_startup_files()). Why?
> >>     
> >
> > I guess the reason was related to the current behaviour you
> > described below. Otherwise, I'm not sure.
> >   
> It would be cool IMO that it simply open the other files in the
> project, I would use this sometimes. And I don't think it changes
> anything to the users that don't want this.

I completely agree here.

> >> 2. There is a related bug-report: [1]. Currently a command like
> >> "geany file.txt" does not open default session. I think the
> >> proposed behaviour (default session SHOULD be opened) is better.
> >>
> >> With current version it's impossible to force the session to be
> >> opened, while with proposed behaviour everything is simple: if you
> >> want the session to be opened, type "geany file.txt"; if you don't,
> >> type "geany -s file.txt".
> >>
> >> To be precise, with current version default session IS opened, but
> >> its files not. That means, the default session is overwritten
> >> after Geany is closed. A user may not like that (like any other
> >> unpredictable destructive behaviour). 
> >>
> >> The new behaviour is backward-incompatible, so maybe(?) it's worth
> >> providing a hidden option to turn on the new behaviour, like Nick
> >> suggested in the comments to the bug-report.
> >>
> >> Any thoughts? If anyone votes for the new behaviour, I can
> >> implement it (in SM branch).
> >>     
> >
> > I don't mind much but having a preferences (even a GUI pref)
> > probably won't hurt and if you like to implement it in your branch,
> > even better (maybe just skip the GUI pref part for now).
> >
> > Other opinions?
> >   
> I'm completely with this. I was always annoyed by the behavior of
> "geany file" not opening the default session. Why? mostly because
> sometimes I just want to open a file with Geany, and I don't
> remember/realize/pay attention that Geany is not already opened, and
> as I strongly use the default session, I need to reopen some files
> manually that would have been reopened automatically by the session.
> 

Okay, I wrote a sketch for it, even with a GUI preference: [1]. If you
have a better label for this option, tell me :)

> Ah, and another thing on the topic (or close to): I think that the
> default session should probably NOT be saved if a project is opened.
> Why? because:
> 1) It is probably useless: the list of opened files is already stored
> in the project, no need to save it twice.
> 2) I often have more than one instance of Geany opened: one with the
> default session (for small stuff unrelated to a specific project, or
> to too small projects to need a project file, or for every file I
> need to edit  and close just after that, etc.) and one or more with a
> project opened. I'm used to close the Geany's instances in the right
> order - the projects, then the default session - but sometimes I do
> it wrong, and then I loose my default session to something I have
> already in a project file.

Enrico and me discussed the behaviour of --new-instance command line
option not so long ago. We decided that instances run with
--new-instance should not ever touch the default session. AFAIR, in
current trunk this option causes Geany not to load the session. In my
version it also causes Geany not to save the session. The version in SM
branch *partially* implements the behaviour: when I wrote the
corresponding patch, I did not think about projects, so projects are
not handled properly. Recently I coded the behaviour completely, the
changes are ready to be committed.

> 
> But about the preference to choose the behavior, I don't thing it
> would be useful. I don't see any case where it makes sense: if a user
> won't the session to be restored at startup, she just have to uncheck
> the preference that already exist and she's done.
> 

Me too. But we can't be sure that there are no users who wants the old
behaviour. The way how other people use Geany may differ from ours… I
think we need more opinions.

Also, It is easy to code the GUI preference, and the preference makes no
harm to users (except they have to read one more label in the dialog)
-- not a very high price for being compatible with older versions. So,
we can keep the option until we are sure that it can be safely removed
and almost nobody will complain.


Enrico: another bunch of commits are ready. They are:

* Use absolute paths to project files. Particularly, paths to recent
  projects' files are now stored as absolute.

* Make --new-instance imply --no-session, even if a project is opened.
  An addition to rev. 4567.

* Load files from command line even if a project is being opened.

* Add a GUI preference to control whether the default session is loaded
  if any files are opened via command-line (fix #2838686). Location of
  the preference: General > Startup tab > Startup frame.

Relative paths to projects' files were a little trouble for me. When
I run Geany within the source tree for testing, passing a project, Geany
remembered it, so now my Recent Projects menu is full of the same
project file with different relative paths :)

What do you think? Can these be committed (together with updated
changelog, of course)?


[1] <http://xmages.net/upload/ff71e4ee.png>

Best regards,
Eugene.



More information about the Devel mailing list