[Geany-devel] Proposed patch to fix issues with command line file loading

Lex Trotman elextr at xxxxx
Sat Jan 29 00:11:27 UTC 2011

Hi All,

Since its Saturday I've looked back at the thread and, at least for my
own benefit, I'd like to try to summarise what I think the *preferred*
behavior is.

I haven't attributed suggestions to anyone since many have
participated in the thread but if I've misrepresented/misunderstood
anything please comment.

1. Geany has one default unnamed session (per user) and named sessions

2. A Geany instance can have only one session open at once.

3. When the first Geany is started or Geany is started with
--socket-file pointing to a non-existent file:

a. if the "do not reload session" preference is set or -s specified on
the cl, do not load the default or a previously open named session,
load a session specified on the command line or else start a new
default session

b. if the "do not reload session" preference is not set and -s not
specified, load a session specified on the command line or the
previously open named session or the saved default session

c. a. or b. can be overridden by a --in_new_session option that opens
a new default session.

d. any files on the command line are opened and added to the session
that results from a, b or c.

e. the -i option is ignored

f. when Geany is closed save the current session (default or named)
and save which is the current session so it can be reloaded.

4. When a Geany is already running and no --socket-file or
--socket-file points to an existing file and no -i is specified:

a. if there is no session file specified on the cl and
--in_new_session is not specified then load the files in the instance
of Geany that matches the socket file and add them to the open

b. if a session file is specified or --in_new_session is specified
then close and save the current session in the instance of Geany that
matches the socket file and open the specified/new one then open the
specified files and add them to the session.  --in_new_session
overrides a specified session file.

c. having opened files in the existing instance, quit this one and
don't save anything.

5. When a Geany instance is running and -i is specified:

a. start a new instance of Geany, and behave as in 3. with "do not
reload session" set.

b. On close if the current session is the default session do not save
it, if it is a named session save it but do not save that it is the
current session.

Issues about other preferences and other multiple instance behaviors
are not the topic of this thread and have been ignored.

I think after the patch, except for the new --in-new-session option,
the behavior is close to this but correct me (or the patch :-) if I'm

The --in-new-session is for files opened by file managers or downloads
from firefox etc so that the current session is saved and not mucked
up by the new files.  This behavior was requested several times in the
thread but since it isn't the right thing all the time I am suggesting
making it an option.  The previous session can then be restored by
Project->Recent projects-> for named sessions or a new reload default
session menu item.  Or make the new menu item "reload last session"
and let it figure out which it was.


More information about the Devel mailing list