Sublime Forum

Ctrl+q Has Erased all my Projects

#1

The title says it all, whilst trying to solve another issue I turned off hot exit and then pressed crtl+q (thinking this would close ST3 ,3.2.1.1) When I clicked on the ST3 icon again I just got a blank window. When I tried to open a recent project, the folders are included but all the panes are empty. If I open (through open a file) the specific workspace pertaining to that project contains information, and the sublime-project file contains the paths.

On the things I was working on recently I can remember what was open and some of the files, but on the bigger projects, this is a Problem.

Is this expected behaviour ? Maybe it is…(I’ll pass no further comment)

Is there any way of getting the open file infomation, I might have saved a workspace or two on git, but the current situation is pretty terrible so if anyone can help that’d be very much appreciated ?

In summary all my saved projects are current empty, and loading recent projects ( from Project => Recent) just loads blank screens.

Lozminda

Ps Needless to say I’ve turned hot_exit back to true
PPs I’ve done some testing, ctrl+q wipes projects even if they’re saved if hotexit is turned to false. I’m guessing this is expected behaviour? But it would seem to go against some of the advice that I was given on this forum (A learning experience I guess, I’ve had a lot of great advice, I was bound to get some duff stuff eventually)

Hot_exit true preserves state,


DONT TURN HOT EXIT TO FALSE

unless you’re really sure that’s what you want…

0 Likes

#2

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.

0 Likes

#3

All I wanted was one project to open on one workspace and another on another…Soooo frustrating…

Thanks for your reply.

0 Likes

#4

Thinking about it, hot exit isn’t preserving state, or not the exact state that I have; at the beginning of every session I have to suffle everything around.
The solution is leave hot exit true, write a system script to close ST3 on shutdown and use subl on start up. I’ll have to write a system script; there isn’t however an ST3 answer which is/would have been fine. I have learnt a valuable lesson today.

Anyroad, cheers Mr Martin!

0 Likes