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

Lex Trotman elextr at xxxxx
Sat Jan 29 10:59:37 UTC 2011

On 29 January 2011 19:35, Eugene Arshinov <earshinov at gmail.com> wrote:
> On Sat, 29 Jan 2011 11:11:27 +1100%
> Lex Trotman <elextr at gmail.com> wrote:
>> 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
>> (projects).
>> 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
>> session.
>> 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.
> Do I understand correctly that if a type-3 instance matching the
> socket file is running, it will close its session and all files and
> load files and (possibly) session specified here?  If true, using
> --in-new-session for file managers etc. does not seem acceptable to me
> as user looses everything he has in already running type-3 instance
> every time he opens a file in a file manager.

Hi Eugene,

The intention is that the interrupted session is re-loadable (as per
final comments) so it isn't "lost" but...

Neither a nor b is the right solution all the time, a always mucks up
your existing session, b can't add things to an existing session.

Sadly file managers and similar only have one default.

Therefore which one you choose to configure the file manager default
with will depend on your most common workflow, if it is to open things
from the filemanager several times to the existing session then you
want a. but if, like me, you open most files in Geany itself you can
use b to make the filemanager/firefox open files in a new session, and
you can add any more files to this new session within Geany (since it
now defaults to the directory of the open file, which is most likely
where you want to add extras from). And then you can recover the
interrupted session later.  Thats the use case for b and thats why I
made --in-new-session an option.

>> 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
>> wrong.
>> 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.
> BTW, great summary.

Glad its helpful,thanks.

>> Cheers
>> Lex
>> _______________________________________________
>> Geany-devel mailing list
>> Geany-devel at uvena.de
>> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

More information about the Devel mailing list