Following the idea in "Proposed patch to fix issues with command line file loading", here is a rewritten load_startup_files(), which:
1. Always loads the CL project. Currently it's ignored if "Load files from the last session" is unchecked, which is certainly a bug.
(Well, almost always: if a primary instance is running and -i is not specified, the CL project should be open in the primary instance, but on my system that doesn't happen. Doesn't look like a problem with load_starup_files(), so ignoring it for now.)
2. Always loads the CL files. Presently, any files specified after the project file are ignored; I could not find a reason for this, other than the layout of the current load_startup_files(), and it's marked with ATM, aka "at the moment". Well, IMHO, the moment came.
3. Ignores --no-session if specified together with a CL project and "Project based session files" is checked (it normally is). In this situation, the old implementation opens the project with an empty file list, which is then saved in the project - I believe nobody would want that. Attempting to "properly" (whatever that may be) apply -s to projects creates various problems.
4. With "Project based session files" unchecked, specifying a project on the command line does not affect loading the default session in any way. I haven't tested how exactly the old code works, but is does not check the value of PBSF, so it's something different.
5. Is cleaner, a bit shorter (except for the comments), and can be easily customized for things like XSM, preference to load the default session even if CL files are specified etc.
The patch was discussed a bit on the development list.