hot_exit
tells Sublime whether it should store state or not.
When it’s turned on (which is the default), quitting Sublime will cause it to persist the state of every open window, which includes what files are open, what part you’re looking at, what the selection is, the undo stack (if you’re using ST4), and so on.
The state for windows with associated sublime-project
or sublime-workspace
files are stored in the workspace file; a sublime-project
always has at least one sublime-workspace
associated with it (can be more), but it’s also possible to use a sublime-workspace
file on it’s own.
So, in the default state, closing windows or quitting Sublime always puts you into an expected state:
- Close a window with a project in it; the next time you open that project, the window restores back to what it had in it.
- Close a window without a project in it; the session in that window is lost. You’ll be asked if you want to save any changes to files that have been modified, but then the layout and state of that window is gone forever.
- Quit sublime, and when you restart it, every window comes back exactly as it existed before you quit, as outlined above.
If you turn off hot_exit
, then none of this happens:
- Close a window with a project; if there are any unsaved changes to open files you’ll be asked to save them. When you reopen the project, the window will be empty (because you told it via turning
hot_exit
off that you didn’t want it to persist any state).
- Close a window without a project; behaves exactly the same as a window with a project, except that you can’t later re-open the window because there’s nothing associated with it.
- Quit Sublime; every window will be closed according to the above two points; any unsaved changes will be saved presuming you say you want it to be saved, and when you restart Sublime, you end up with one pristine empty window as if it’s the first time you launched Sublime.
So on that basis, what you’re experiencing sounds exactly like what I would expect if you turned the option off. All of your projects still exist, their files are still on disk, but you told Sublime to not store any window state, so they open up that way.
Based on the post in your other thread, it sounds like you’re running into the classic problem of both wanting Sublime to persist the state of everything so that it comes back, while also wanting it to not persist state, but these two things conflict with each other.
Generally, you either turn on hot_exit
and then assume that when you start Sublime, it’s going to come back the way it was before (in which case, don’t start it trying to open a folder or project, just start it) or you turn it off because you want everything clean every time.
The option for hot_exit
is augmented slightly in ST4:
// Exiting the application with hot_exit enabled will cause it to close
// immediately without prompting. Unsaved modifications and open files will
// be preserved and restored when next starting.
//
// Closing a window with an associated project will also close the window
// without prompting, preserving unsaved changes in the workspace file
// alongside the project.
//
// Hot exit has different modes to choose from:
// - "always": Always perform a hot exit when the application exits. This
// includes when the last window is closed on relevant
// platforms.
// - "only_on_quit": Only perform a hot exit when the application is asked
// to exit, not when the last window is closed. This
// setting is only used on Windows and Linux.
// - "disabled": Disable hot exit.
"hot_exit": "always",
That is, there’s now an option to only persist things when you quit explicitly, since on Windows and Linux closing the last window also implicitly closes the application. That doesn’t work on MacOS because the convention on MacOS is to keep applications running in the background even if they have no visible windows.
It doesn’t sound like this would resolve your particular issue though, except that it sounds like your ultimate problem is wanting Sublime to restore it’s state back onto specific workspaces and I believe that’s enhanced in ST4 in general, so swapping to that version would probably just natively do what you want. However I’m no longer a multi-workspace person so I have no personal experience with that.