Don't open previously opened files on new start


#21

I think it’s interesting to note that:

  • When I don’t want Atom to remember files, there is no way to turn it off without resorting to hacks (as @rubysolo pointed out above).
  • When Atom should be remembering files, it rudely dumps them (the whole project in fact) and forgets about them entirely; see https://github.com/atom/atom/issues/9643 .

So Atom basically does the opposite of what I want it to do in both cases.


#22

I would also like a way of doing this without resorting to hacks :slight_smile:


#23

Running rm ~/.atom/storage/editor-* doesn’t seem to work anymore.

I accidentally opened a large file that was just one line which caused atom to freeze.
After I closed it and opened it on the folder again it just reopened the file and froze again.
I tried rm ~/.atom/storage/editor-* and still the same problem.

It would be nice to have a way to either disable this or for problems like mine a reliable way to reset the opened files.


#24

There is.


#25

my init.coffee has only one line:
atom.open("")
it will meet your need.
with this, atom will try to open the file “” but can’t
so atom open a new window with no file opened and even no tree-view


#26

atom.open("")

Nice. Combining this with olmokramer’s way of closing previous tabs get’s the behavior that I want when I open a previously opened directory: no open files.

My init.coffee now looks like this:

atom.open("")

process.nextTick ->
  atom.workspace.getPaneItems().forEach ->
    atom.workspace.destroyActivePaneItem()

(It still opens tree view when I open a single file though, but most of the time I can live with that.)


#27

None of the above workarounds work for me at the moment; but this does. Replace ~/.atom/storage/application.json with:

[
  {
    "initialPaths": []
  }
]

Then start Atom, and get one blank/empty editor.

From a bug-noting standpoint, my applicaton.json content is updated when I exit Atom with 53 repetions of the empty initialPaths stanza.


#28

This is something you should report as an issue on the Atom repo, along with your OS, version of Atom, and whether it happens when you started Atom with atom --safe.


#29

@alexkolson This is happening to me also. Did you find a solution on how I can make it open a blank file when I open Atom? It’s really annoying to have my last session restored :smiley:


#30

+1 for a way to always open a nice, fresh, empty editor.


#31

Atom has had a setting to control whether to restore the last session for a number of releases. The setting has always defaulted to enabled and it has been exposed in the GUI in v1.14-beta:


#32

This setting doesn’t work for me… I’ll try out the new beta, according to someone in this topic it’s a known bug.


#33

Open Empty Editor On Start is a different setting. In Atom 1.14 the description for Open Empty Editor On Start was changed and Restore Previous Window On Start was added to the GUI. You can read about the changes in the PR or try it out in beta:


#34

My solution is to loop through the TextEditor objects and call destroy() on them at the beginning of coffee.init.

Then I add a directory to the project tree and open my “to do” list.

editor_list = atom.workspace.getTextEditors()
for text_editor in editor_list
  text_editor.destroy()

atom.project.addPath('S:\\devel')
atom.workspace.open('H:\\TODO\\TODO.md')

#35

or remove IndexedDB in (C:\Users\...\AppData\Roaming\Atom) for me works fine, but not checked what else will reset


#36

In the terminal, atom --clear-window-state clears the cache for opened files.

It’s not on startup as OP wanted, but since this page is the first result on google for “how to get rid of atom opened files” I figure I might as well put it here. (I opened a large file and atom crashes on startup every time)