[Geany-devel] Separating session file lists from config (again)

Colomban Wendling lists.ban at xxxxx
Mon Oct 1 14:43:01 UTC 2012


Le 10/09/2012 06:36, Lex Trotman a écrit :
> Hi All,
> 
> Its about that time of year when we have our annual discussion on
> separating session data from config/project data :)
> 
> By session data I mean the list of currently open files and MRU list.
> 
> The advantages (that I can see):
> 
> 1. Save config/project as its changed and not rushed at quit time (and
> the quit save doesn't happen in the absence of a working, portable,
> session management capability)

TBH until proper multi-instance configuration sharing, I don't see
what's so great with "not rushing at quit time" since we already also
save one pref/project-prefs apply.

> 2. Save session data periodically, or as it changes, or whenever,
> without touching the config/project files.  So the config isn't at
> risk if the session save goes wrong.

Why would the session save go wrong?  There is no reason I can think of
that would make periodical session saving less safe than settings saving.

> The only disadvantage for user config (that I can see) is that it adds
> one file, say geany.session.conf alongside geany.conf

That's definitely not a problem in the $GEANY_CONF_DIR.

> For project sessions just using another file in the same place as the
> project file is more of a problem since project files can be in the
> project tree and some people like to save them in VCS.  So users would
> have to make sure that their git.ignore (or whatever the other VCSes
> use) is edited each time so that the session file isn't saved in the
> VCS.

I agree with Dimitar, if somebody is able to add a file to a VCS she
must be able *not* to add that file.  Is there *any* VCS around that
adds files without asking before, unless explicitly told so?  Nobody
sane will do `git add .` or `svn add .` for committing changes.

> A better option, especially since sessions are inherently user
> related, is to store them in the user config location (or subdirectory
> thereof).  But how to link these files to the project files?
> 
> The proposal is that each project gets a UUID generated when it is
> created (or when its opened without one) which is saved in the project
> file.  This uuid is the name of the session file in the
> ${GEANY_CONFIG}/sessions directory.  That way, when a project is
> opened, it is easy to uniquely find the session file if it exists.
> Using things like filenames, project names etc will always have
> clashes.  Libuuid is used by GTK so it will always be available on all
> platforms we use and so making the UUID is one call. (Pity GTK doesn't
> expose it though)
> 
> The number of session files can be left to grow like weeds, or can be
> trimmed to a (configurable) maximum number deleting the oldest when
> needed.

PLEASE, no.  This is IMO the easiest solution to make the fix worst than
the issue.  Not removing files would leave more and more useless files
(not an option), and cleaning is almost impossible to do well -- your
proposition might remove actually used sessions as easily as having >
MAX_SESSION projects (not an option either).

> This proposal isn't about a proper session management capability,
> there isn't one that works on enough platforms to be worth including.
> 
> Any thoughts welcome.

Reading my mail above, I see it might sound like I think $subject is
just a bad idea.  No, I think it would be a quite good thing, and for
weird people adding project files to their VCS [1] would be most
welcome.  I also think that separating session and settings will
probably help to someday improve the settings sharing between instances.

The only problem is that I don't see immediate and tremendous gain, and
that I don't like the proposed solution -- not that I have a better one.
 On the first point, I'd be happy to be proven wrong though, maybe I
just don't see the light.

Regards,
Colomban


[1]  Yes, I don't really see the point.  OK, the settings we have in
project files might be useful for the project.  Indentation type & with,
and EOL style.  First two are saved in each file by well known editors
(vim, emacs).  Generally when people put project files in their VCS it's
because those project files are used as build system too.



More information about the Devel mailing list