Close active file (or better idea)


In the jekyll package I am currently adding support for drafts which has the need for a file to be moved around. As an example I would need to move /jekyll/site/_drafts/post-title.markdown to /jekyll/site/_posts/2015-02-12-post-title.markdown as well as updating the date in the front matter.

I’ve got this bit working fine and you are presented with the new file but the old file is still open and when you close it Atom (correctly) warns you that your buffer is different to the file and asks if you want to save it.

Is there a way to close the currently open (or specified file) preferably in a way where atom would warn about things not beign saved etc…


If you know how to retrieve a reference to the TextEditor you want to close you can just call its ::destroy method, there won’t be any confirmation for that action.


Thanks, thinking about it I use the current editor contents to create the new file so we do save it as we publish.

Only issue now is that destroying the active editor causes it to jump to another open file which then seems to stop it swapping to the new file I’m opening.