Sublime Forum

Hot_exit not working?


I am a new Sublime user trying the software. The main feature I need is to work similar as Notepad++ and close the software without saving files, and reopen later to continue the work. I thought it worked initially, but now each time I start Sublime and create a new blank document, the software does not close without asking me to save the file. By close I mean pressing the X button in Windows 11. The hot_exit setting is set to “always” inside the default Preferences.sublime-settings. I tried putting the hot exit settings in the personalized settings too, but nothing changed.

Anyone can help with this software? It is already a bad start that I need to spend time registering in forums and googling around to have such a simple function. And it does not help that settings are a json mess instead of any organized user friendly gui.



Do you have multiple windows open? If you’re closing a window that won’t close the rest of the application, so doing so means that window won’t be restored.



No, I have a single Sublime window open. This is not a matter of windows because I have restarted the computer multiple times in the last few days and the issue persists.



The inference here is that clicking the X in the top right of a window to close the window is not always the same as exiting the application, which is true across all operating systems. On Linux and Windows, closing a window just closes the window, and if that happens to be the last window, then the application always exits, whereas on MacOS you need to explicitly exit an application because it will keep running quietly in the background with no windows.

All this to say, does File > Exit to exit the application behave differently than closing the window via the button in the caption? By default as you’ve seen hot_exit is turned on and will take effect, BUT it only applies when the application quits and not just when a window is closed.

If File > Exit successfully quits and saves state and allows you to restore when using the X to close a window doesn’t, then the most likely culprit is that there’s another window open somewhere (maybe hidden) that’s keeping the application open when you close the window.



It happens as you say, unfortunately. File -> Exit does not complain and just exits without saving files, while the X button prompts to save the file.

I have no other window open, nothing I can see, I just checked all the virtual desktops (I am on Windows 11). My version of Sublime is Build 4126.

Is there any other way to fix the problem, and, more importantly is there a way to tell Sublime that pressing the X is the same as File -> Exit?



You can find the screen record of the problem here:



Using File > Exit in your screencast, it’s behaving as expected; it shuts down without prompting you, and when you restart it comes back to the state it was in, which will include all open files, including any changes made but not saved. So in that respect, it’s working as expected.

Closing the last window should do the exact same thing:

	// 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",

As it says in the comment for the always value (which is the default), this includes closing the last window on relevant platforms (of which Windows is one).

If it’s truly the only window and still not doing that the only thing I can think of is something related to it being Windows 11 and not Windows 10. I know that there are at least a few people in the Discord using Windows 11 and I’ve not seen anyone report this issue previously though.



Do I need to report a bug somewhere? Do developers come to read this forum?



They do, but with the volume of posts that the forum sees reports here get buried easily. The official place to report a bug can be found by using the Help > Report a Bug menu item, which will take you to the appropriate place.



My guess is that you have another window open, perhaps on another workspace? You can check by seeing if the application is still running in task manager after you’ve closed the “last” window.



Exiting with File -> Exit leaves no other trace of Sublime in task manager, neither in Processes nor in Details. I have looked for a solution for days, and just uninstalled and reinstalled sublime. But I just noticed that starting Sublime in safe mode resolves the problem. It does not ask to save files in safe mode, but when I go back to regular mode, it turns asking again to save.



I opened a bug report, will see.



Uninstalling and reinstalling has no effect on most problems because it leaves your configuration intact. On the other hand, Safe Mode replicates an out of the box experience. So all else being equal, if it works as expected in safe mode, that would be an indication that something is going on with some package, plugin or configuration in your install.



Exiting with File -> Exit leaves no other trace of Sublime in task manager, neither in Processes nor in Details.

File > Exit exits the application (closing all windows), is the application still running after you close the last window?



I solved it, but in a convoluted manner. Here are the steps I had to perform.

  1. I deleted the folders in %APPDATA%\Sublime Text, but two folders could not be deleted. I installed IObit Unclocker to find which program had them open. No luck, there was no program keeping them open apparently.
  2. I kept going and uninstalled Sublime. Tried to remove the folders above again but they were still stuck.
  3. I then shutdown and started the computer again. Then tried to remove the leftover folders in %APPDATA%\Sublime Text and finally succeeded.
  4. Deleted the cache folders in %LOCALAPPDATA%\Sublime Text.
  5. Installed again Sublime and started.

The above worked and finally I can exit the application by pressing X without saving data. I saw this behavior the first time I installed it, but something has happened later. The only thing I remember (if it helps) is changing the GUI to Light mode and installing a couple of Markdown packages.