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

Unsaved buffer state isn't silently preserved when the Window has no project folder #13318

Open

Description

@iolsen

Unsaved buffer state is preserved as part of the project system. When there is no project, it doesn't get saved. Prior to this fix this behavior could result in data loss. That's now fixed, but seamlessly preserving state as Atom does for projects would be more convenient and is the more elegant fix.

We would readily accept a well-tested PR providing this functionality.

See also #10474.

Activity

  1. rreinhardt commented on Dec 11, 2016

    @rreinhardt

    I would like to suggest the addition of the label "data-loss" to this issue.

    Having followed along from #10474, I think it's worth commenting that preserving the unsaved buffer state is important for non-project documents because of situations where Atom is closed without having the time/ability to offer up the save prompt to the user.

    A couple cases that have resulted in data loss for me in the past:

    1. When the Computer loses power (laptop runs out of battery).

    2. When the Application/System freezes so that the process has to be killed.


    I also think there is greater usability for the application to constantly be at a saved state than have the user make a decision(s) at the time of closing the application.

  2. hydrandt commented on Dec 18, 2016

    @hydrandt

    I currently use Atom 1.8.0 on debian unstable, and the session/buffer saving has been working fine for quite a while, even for two atom windows in two different KDE activities.
    Then Firefox used Atom to open some file I downloaded and all the sessions (and unsaved buffers) are lost.
    Where does Atom save the sessions and unsaved files content? Is there a way to get the sessions back?

  3. winstliu commented on Dec 18, 2016

    @winstliu
    Contributor

    Atom 1.13.0 features a new Reopen Project feature that you can use to return to your old projects. Otherwise you would have to reopen the folder/folders that you were editing.

  4. Curros commented on Jan 5, 2017

    @Curros

    Wow I just expend 1h looking to all the mess around this "bug".
    I'm using W10x64 - Atom 1.12, and i have the same issue.

    @50Wliu if the file is not saved, you lost it. Even using Ctrl+Shift+T

  5. Curros commented on Jan 5, 2017

    @Curros

    I just instal Atom 1.13 beta and works "fine"!
    Using W10x64 - Atom 1.13

    PD: If I open the tree-view I can see that desktop is linked, probably is using it as project.
    PD2: If I open other project the oldest buffer (not saved file) is not showed, but if I open no project again (desktop) I have the old buffer.

  6. ctwise commented on Jan 5, 2017

    @ctwise

    Nope, Atom 1.13 beta still isn't working. It requires you to save the buffers. Sublime doesn't. That makes it perfect for scratch pads, open a new tab and start typing and pasting. Close Sublime, open it back up and the untitled buffers are still there.

  7. winstliu commented on Jan 5, 2017

    @winstliu
    Contributor

    @Curros I think you misunderstand this Issue. When there is no project folder open, Atom is (currently) incapable of saving the editor's state. Before, it would throw it away, which led to data loss. Now, it asks to save those files, which is considerably better than before, but still not at where we would like it to be - a consistent saving experience with or without project folders.

  8. lePereT commented on Jan 6, 2017

    @lePereT

    I think that Atom could certainly learn from Sublime's default behaviour here. There are times when I've reopened Sublime after some days and found work/musings that I'd not even remembered I'd lost. This makes it a perfect environment to work in. Atom, I've been burned twice on 1.12 already. The 1.13 beta behaviour is better, but still unpredictable and therefore poor.

    What's the technical barrier to implementing this fix?

  9. ctwise commented on Jan 6, 2017

    @ctwise

    I believe they made a technical decision that contents of tabs are tied to "projects". No project, no auto-saving of content. I'm guessing that this issue would require some re-architecting of that approach and they really don't want to do that.

  10. winstliu commented on Jan 6, 2017

    @winstliu
    Contributor

    Yeah, @ctwise is pretty close. We choose the state key by passing in the open project folders and computing a SHA1 of that. If there's no open project folders, then we don't compute a key and hence the state doesn't get saved.

    That being said, I did just rediscover #11122. I'll try to get some 👀 on it.

  11. lePereT commented on Jan 6, 2017

    @lePereT

    Would be great, cheers. Even VS Code has recently added this behaviour in the form of 'hot exit' I think. I found it pretty invaluable when working on a desktop in Ghana last week with rolling blackouts. Pretty extreme coding :D

  12. caesarsol commented on Feb 23, 2017

    @caesarsol

    Hello, I'm coming from Sublime as well and expected this feature! Would be wonderful to have it back 😄

    Could a strategy be to associate a common default project to all project-less tabs?

  13. bnlawrence commented on Mar 1, 2017

    @bnlawrence

    So, I don't think the "fix for telling me to save" (this one?) even works. As far as I can tell (1.14.4 on Mac Yosemite) atom still just silently kills my data when I close the window, no prompt, just data loss. Like everyone else, I'm so disappointed. Atom seems like magic, with the potential to really improve my workflow, but it has this yawning fatal problem. Not everything is a project ... and when things are time critical, I'd rather be working slower and know I wont have to do things twice than working faster but losing stuff.

    I can't risk this, so like many others, it's back to sublime.

  14. 31 remaining items

  15. aronj commented on Mar 12, 2019

    @aronj
  16. soleares commented on Apr 6, 2019

    @soleares

    @Ashkaan Most editors I've used on the Mac support this. BBEdit also does.

  17. mjarmijo commented on Jan 29, 2020

    @mjarmijo

    Just lost some data from my laptop restarting over night. Would really like this feature!

  18. thargenediad commented on Sep 24, 2020

    @thargenediad

    Please add this feature! It's the sole reason Atom isn't my main text editor.

  19. CommanderPirx commented on Dec 7, 2020

    @CommanderPirx

    I can't believe it's been literal years since the lack of this feature has been highlighted for the first time and countless time people chimed in in the meantime about it, and yet nothing has been done about it. It's most basic and fundamental feature any worthwhile text editor should have. I just bounced off of Atom HARD because of it.

    Oh well, I guess back to looking for an alternative editor...

  20. bean-drew commented on Jan 6, 2021

    @bean-drew

    Looking for a free lightweight text editor for Mac (ie. Notepad++, but for Mac) and was recommended Atom. Figured out how to disable the project pane (via disabling a package), only to find (here, now) that the failure of session-save was because I wasn't opening my documents as part of a project ... Why does Atom need me working in projects - That does not align with my workflow. It also seems a bizarre omission, given wide adoption of this mode across other editors. However, across this thread and the linked "Unsaved buffers" thread it seems that this has been a long-identified issue that isn't changing. So per comments I've seen here I guess it's off to try Sublime [edit: not free]. Otherwise Atom looked nice, so, feature request?

  21. corsel commented on Feb 25, 2021

    @corsel

    Wow, I wasn't expecting to see so much heat around this for literally years when I decided to give atom a try and shortly after started looking up google how to keep the unsaved session. I guess I'm also switching back to notepad++.

  22. JoshCheek commented on Mar 24, 2021

    @JoshCheek

    This hits me very frequently (probably several times a month for the last several months, though there were times it happened multiple times per day) and it's the primary reason I'm looking at other editors. I've lost important meeting notes, todo lists, code snippets I was composing from REPL sessions, etc.

    Perhaps it should be noted that I am almost always working on unsaved files. I dev in vim, and take notes / paste things I want to get out of the clipboard / experiment in Atom. So the idea of a project root or a file path is foreign to my mental model when using Atom, I am 99% of the time thinking about operations on an in-memory buffer. And it's just brutal to lose 10 buffers with important notes for the second or third time in a week.

    I'd super appreciate a priority elevation for this issue.

    While I came here to express this frustration, I've generally been >90% happy with Atom for 6 or 7 years now, so want to make sure to say ty times a million to the maintainers. 🙏❤️

  23. Philipp91 commented on Apr 11, 2021

    @Philipp91

    I only need a text editor for single files, as I have other (language-specific) IDEs for programming. This means that I can use a workaround for this issue in Atom: Menu "File -> Add Project Folder" and specify sth like ~/.atom/default-project. (Optional: Hide the unhelpful "Project" pane on the left.) Now any open files and any newly opened files seem to be assigned to that default project and hence they get saved/restored as I expect. Or at least I haven't found a corner case where this workaround breaks so far. E.g. things like atom somefile.txt on the shell work fine.

  24. tom-newhall commented on Aug 18, 2021

    @tom-newhall

    Hi, I'm something of a Newb with Atom.

    I just want to confirm my understanding of the above issue---as of version 1.58.0 (using on 8/18/21)---there is no way to recover unsaved data from a previous session, even if autosave and autosave-onchange were enabled in the previous session.

    Is that correct?

    Thank you.

  25. bobemoe commented on Aug 18, 2021

    @bobemoe

    @tom-newhall there is sort of a way, see the workaround mentioned in the post above yours. i.e always have an open project.

  26. tom-newhall commented on Aug 18, 2021

    @tom-newhall

    @bobemoe Thank you for that; that workaround appears to work, for now at least. (I added my dropbox root as my ("default") 'project folder'; opened a new file in Atom; added some content; did not save it; restarted the computer. The file and content was there when I restarted atom)

    Now that I've "Added" a "project folder" (added to what, I wonder?) should that stay as my "default" project folder on this machine, or do I need to re-"add" this folder every time I restart Atom from scratch? Is there a way I can check what "project folders" have been "added" to Atom?

    Thanks again for the help

  27. JoshCheek commented on Sep 17, 2021

    @JoshCheek

    This hits me very frequently (probably several times a month for the last several months, though there were times it happened multiple times per day) and it's the primary reason I'm looking at other editors. I've lost important meeting notes, todo lists, code snippets I was composing from REPL sessions, etc.

    Perhaps it should be noted that I am almost always working on unsaved files. I dev in vim, and take notes / paste things I want to get out of the clipboard / experiment in Atom. So the idea of a project root or a file path is foreign to my mental model when using Atom, I am 99% of the time thinking about operations on an in-memory buffer. And it's just brutal to lose 10 buffers with important notes for the second or third time in a week.

    I'd super appreciate a priority elevation for this issue.

    While I came here to express this frustration, I've generally been >90% happy with Atom for 6 or 7 years now, so want to make sure to say ty times a million to the maintainers. 🙏❤️

    sigh this is so absolutely tortureously brutal. Also, it's a regression, because this did not used to happen. I can't tell whether I'm lazy or a masochist for continuing to use Atom. It would be deeply appreciated if someone on the Atom team would at least acknowledge that this is a serious this issue. Literally every time my laptop runs out of power, I lose every single open buffer. Usually this is ten to twenty buffers. I put off restarting my computer because I don't want to lose what's in my buffers, but then I'm distracted and run out of battery and lose them anyway 😞

  28. icecream17 commented on Sep 17, 2021

    @icecream17
    Contributor

    Added to todo list. But I have a lot of things going on in my personal life. Since there's not many contributors,

    Could this be a workaround? #9968 (comment)

    Helpful for future me: #10474 (comment) > #9968 (comment)

    Does anyone know where the code dealing with saving buffers is?

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions