Skip to content
This repository was archived by the owner on Nov 4, 2019. It is now read-only.

Autosave after losing focus#38

Open
jurriaan wants to merge 3 commits into
rsms:masterfrom
jurriaan:autosave-after-losing-focus
Open

Autosave after losing focus#38
jurriaan wants to merge 3 commits into
rsms:masterfrom
jurriaan:autosave-after-losing-focus

Conversation

@jurriaan

Copy link
Copy Markdown

Added Autosave after losing focus feature, accessible from debug menu

@rsms

rsms commented Jan 19, 2011

Copy link
Copy Markdown
Owner

@jurriaan

Copy link
Copy Markdown
Author

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

rsms commented Jan 20, 2011

Copy link
Copy Markdown
Owner

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

Copy link
Copy Markdown
Author

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants