How to auto refesh file status?

I use a VCS that has a “check out” feature that when not checked out, it is not writable.

Often I check out, edit and want to save, and Komodo9 has not reacted to the the writable flag.

Is it possible to, if the file is believed to be read-only, refresh the file status before it gives me an erroneous message about “make writable”?

Pseudo code:
OnSave(File) {
if (not File.Writable) File.refeshFileStatus()

}

This isn’t fully tested as I don’t have a test case nor the time to set one up, but this should get you on your way:

var originalSave = ko.views.manager.do_cmd_save.bind(ko.views.manager);
ko.views.manager.do_cmd_save = function()
{ 
    var urls = [ko.views.manager.currentView.koDoc.file.URI];
    var fileStatusSvc = Cc["@activestate.com/koFileStatusService;1"].getService(Ci.koIFileStatusService);
    fileStatusSvc.updateStatusForUris(urls.length, urls,
                                      true /* forcerefresh */);
    originalSave(); 
}

Note that’s quick and dirty, obviously it’s not best-practice to override native API methods. But for a macro and single use-case it should suffice.

Another solution would be to just set a shortcut to your macro and have it invoke save. Then you save using your macro rather than the Komodo save function.

I’ll look into implementing refreshing of the file status before saving.

It should also be noted that while the Force Save dialog is up, is when the background detection should be working and if the file becomes writable it should close itself with the result of saving the file.