How to disable auto-closing of files when they don't exist in switched branch?


#1

I have a branch (“branch_a”) and I am working on files that do not exist in any other branch. I occasionally want to reference work done in a different branch (“branch_b”). The files I want to reference in “branch_b” are not in “branch_a.”

When I switch to branch_b, Atom closes all of the files I was working on (but were saved to disk) that aren’t in branch_b, so I now have Atom with no open files. Likewise, if I open one of the reference files in branch_b and then switch back to branch_a, then Atom closes the reference file. On top of that, I still have to find and re-open all the files I was originally working on in branch_a before I attempted to switch branches. Working around the auto-closing is frustrating.

Is there a way I can disable the auto-closing of editor buffers/tabs when switching branches and they don’t exist in the other branch? So far, searching the web, issues in github, and the discuss forums, I haven’t found the answer. I hope it might be because I just am not looking at the right query terms or not realizing where the option is.

I realize, from reading the posts that I did find, that some (most?) people want the auto-close behavior so I’m not advocating removing it. I sincerely hope it is an option/preference or an Atom package I can easily disable (and I simply just haven’t found it yet) or it can be easily added as an option in a future release so I can turn it off.

Thanks

–James


#2

There isn’t a setting for this behavior. We have gotten tons of feedback from people that want tabs to automatically close (unless they’re marked dirty) when the corresponding file disappears from the disk for whatever reason. Perhaps a package could be built that could mark all open files dirty so that you could retain them?


#3

Thank you for your reply.

Would you (or someone) happen to know the commit/merge where the functionality to close a window when a file disappears was added? It seems to be related to atom/tabs issue #160 but I am completely unfamiliar with Atom, Electron and well, everything, and I couldn’t figure out where it was introduced to know what files/objects/etc changed and how they changed. If nothing else, until an option/toggle is added, I could simply hack the source to disable it for myself if I had some assistance where to look.

The idea of marking all files as dirty is intriguing, but then if a file does exist in both branches I’ll have a new issue of dealing with differences in the file instead of it auto-reloading if it changed on disk and was clean in Atom.

That said, I’d like to maybe give the crude hack approach a go first (if someone is kind enough to nudge me in the right direction) and if that works well then I’ve bookmarked a few examples of adding options to Atom then maybe I can in turn tie it into a formal option that would default to “on” for the masses and can be toggled to “off” for the oddballs like myself and make a PR.

–James


#4

That was specifically to work around a bug with files that were deleted on the Mac. So it was making it work in all cases instead of only 90% of them :wink:

It looks like this is where the subscriptions to changes in the on-disk file corresponding to open editors get created:


#5

Thank you. I’m attempting to set up a build environment now and hopefully will have something in the next day or so (have to give priority of time to project paying the bills).