Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Handle deleted files correctly - #1271

Merged
probablycorey merged 19 commits into
masterfrom
cj-deleted-files-not-modified
Dec 12, 2013
Merged

probablycorey merged 19 commits into
masterfrom
cj-deleted-files-not-modified

Conversation

@probablycorey

Copy link
Copy Markdown

Previously, if a file was open in Atom but deleted from the command line (or git, etc...) Atom would keep that buffer open and mark it as modified. This was annoying because when closing Atom it would prompt to be saved. This PR makes Atom treat deleted files as unmodified (unless the file was modified prior to deletion.)

One caveat still exists. The edit session for the deleted file will still be serialized. So a file that doesn't exist on disk will persist when you restart Atom until you explicitly close it. I'd like to wait and fix this problem after we decide on the future of panes.

Created to solve #693

Comment thread src/project.coffee Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about destroyUnmodifiedNonExistentBuffers?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it much better.

Comment thread src/text-buffer.coffee

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this emitModifiedStatusChanged line moved somewhere else? Just wondering if we still needed it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it now maintains the modified status of the file emitModifiedStatusChanged isn't needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆒

@probablycorey

Copy link
Copy Markdown
Author

I added some 🆕 behavior. If an unmodified buffer is deleted, Atom will remove all editors for that buffer.

Comment thread spec/pane-spec.coffee Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can kill the its pane item is removed from this since it is covered in the it, right? 👇

@nathansobo

Copy link
Copy Markdown
Contributor

I notice these specs pop up a lot of dialogs when I run them for some reason.

Comment thread src/pane.coffee Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried items are going to end up in the state twice here... maybe you should create the state with an empty array and then add them all?

probablycorey pushed a commit that referenced this pull request Dec 12, 2013
@probablycorey
probablycorey merged commit 5d23a8f into master Dec 12, 2013
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.

3 participants