I first reported this bug in the post: Build 3183 ‘save_on_focus_lost’ and ‘About’ problems.
The save_on_focus_lost
setting is still partially broken in build 3200, at least on Linux. [Linux Mint 17 Qiana, Cinnamon 64-bit 2.2.16, based on Ubuntu 14.04.5 LTS, Trusty Tahr.]
When ST is started and usually for one to three hours the save_on_focus_lost
setting works as expected.
Subsequently it stops working when focus is lost to another window. It works when the buffer/view loses focus within the same window; e.g. switching buffers or group, opening the console or the Command Palette, Show Files, Goto, or any other overlay. But when the focus is lost to another ST window, or to any other application, the desktop, system menu, etc., then saving does not automatically take place.
In a (failed) attempt to fix this bug I wrote the following plugin:
import sublime
import sublime_plugin
class BugFixSaveOnFocusLost(sublime_plugin.EventListener):
def on_deactivated(self, view):
if view.is_valid() and view.file_name() is not None and view.is_dirty():
view.run_command("save")
Some additional print
logging statements established that the plugin works as expected.
HOWEVER at (presumably) the same time that the save_on_focus_lost
setting stops working properly my plugin also stops working. I think this shows that there is a problem with the on_deactivated()
method of the event listening system.
Could this problem be due to the Linux move to GTK3?
Although it is of very little consequence the About bug which I also reported here is still present in build 3200. It is of little importance and I mention it again only because it might be related to the save_on_focus_lost
setting problem and might help in diagnosis.
I now simply restart ST when the save_on_focus_lost
setting problem reappears which acts as a 1-3 hour fix, but it would be nice if the problem were to be resolved.
P.S. Might this be related? Active window not being updated on view selection. Build 3200 Linux