Sublime Forum

Bug? Auto-Save on focus re-gained (not focus-lost)

#1

Hi everyone,

I think this is a bug. I’m currently using Sublime Text 2 Build 2216 on Mac OS X. It’s saving a modified file every time it gets the focus back. Say, I’m editing some file, now I switch to another file on another tab and get back to the previous file. Boom! The file gets automatically saved.

I checked my “save_on_focus_lost” and it is set to false. I even copied that parameter to my User settings to force this option but nothing changed. However, this is not the same. Having this parameter enabled, makes Sublime to save the file on “focus lost”, not “focus re-gained”.

Please note that this is happening since some versions ago, although I don’t remember which exactly, sorry.

This is also happening if focusing on another application and returning to Sublime, or even pressing super+shift+p (to access quick panel) and closing it. In summary, the file gets saved everytime it re-gains focus; no matter the reason that made it loose the focus.

EDIT: Some typos.

0 Likes

#2

I just noticed this also. It’s unexpected behavior. Is this something that will be addressed in a future update?

0 Likes

#3

I’ve been playing with this issue some more and it appears like the auto-save is based on file type. What I mean is, for text files (i.e., filenames ending in “.txt”) ST2 does NOT auto-save on focus. However, other types of files (like Python “.py” files or even files with no extension) it does auto-save. Is there anyway to tweak this on a per-file-type basis?

0 Likes

#4

Is there any way someone can look into this issue please? Changing the save_on_focus_lost setting has no effect. I have my browser set to reload pages when local files are saved during web development, and this bug is causing me some major headaches. Thanks!!

0 Likes

#5

Hey guys, I found what the issue was for me… The Git package. In the Git package settings, there is a setting:

// save before running commands
“save_first”: true

Changing that setting to “false” took care of the “save on focus re-gained” issue I was having. Hope this helps!

0 Likes

#6

Thanks! Just noticed the exact same thing on my config, your post was definitely helpful :smile:

0 Likes

#7

Thanks for the post, great find with the Git issue, I was getting quite annoyed.

0 Likes

#8

[quote=“johnpeele”]Hey guys, I found what the issue was for me… The Git package. In the Git package settings, there is a setting:

// save before running commands
“save_first”: true

Changing that setting to “false” took care of the “save on focus re-gained” issue I was having. Hope this helps![/quote]

really helped, thnx)

0 Likes

#9

[quote=“johnpeele”]Hey guys, I found what the issue was for me… The Git package.
[/quote]

Awesome! Thanks for the reply. It turns out that I don’t have the Git package installed, but I do have Modific. That has a similar setting that was causing the auto-save.:

// set to false to disable automatic saving
"autosave": true,

setting this to false fixed the problem for me!

0 Likes