Autosave after losing focus #38

Open
wants to merge 3 commits into
from

Projects

None yet

2 participants

@jurriaan

Added Autosave after losing focus feature, accessible from debug menu

@jurriaan

I think I wasn't clear, but from reading the autosave interface docs I understand it's purpose is to save a file every x seconds, when my patch is about saving focus after cmd-tabbing away from the app.
It's a feature I use every day when I'm doing webdevelopment using Textmate

@rsms
Owner
rsms commented Jan 20, 2011

I see, but what I would want us to do is to use the autosave mechanics (except from the interval triggering part). When the app loses focus, simply:

NSDocumentController *docController = [NSDocumentController sharedController];
if ([docController hasEditedDocuments]) {
  for (KDocument *doc in docController.documents) {
    if ([doc hasUnautosavedChanges])
      [doc autosaveDocumentWithDelegate:didAutosaveSelector:contextInfo:...
  }
}

I'd like us to avoid re-inventing a wheel which has already been invented. :)

@jurriaan

Well, ok, I understand your reasons for using autosave, but I still think it's not the best way to do it, because if a document isn't saved it'll save it to a temporary location (which is not wanted I think).
Yes, I can also check if the document has a URL like this:

if ([doc hasUnautosavedChanges] && doc.url )

But to me it feels like abusing the auto save feature :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment