Not show save warning even when changed?


I have a buffer for a file whose contents don’t matter. In other words the editor is just used as a temporary scratchpad. I want to avoid the save warning and then save or not save, I don’t care which.

I tried returning the buffer to the previously saved state on the TextBuffer will-be-saved event, but apparently the save code had already decided the buffer had changed.

Any ideas on this?


Could you subclass the Editor for that buffer and override the save function to just return?


Your suggestion forced me to actually read the Atom source and I came up with something that works nicely …

atom.workspaceView.getActivePane().model.promptToSaveItem = -> yes

So there is no dialog and it returns true so that it continues as if it had been saved. It is also nice that I can do whatever I want in that function.

Is it generally considered bad form to override core things like this? If a new release breaks my app then I guess I’ll just have to fix it.

I am going to have to do more research before pestering people here with my questions. I am lazy and I always hope someone can just tell me what to do. If I ask enough questions others will be writing it for me. Maybe send me a private msg when I get carried away.

On the node forum I see questions like “I’m writing an app to do XYZ. How do I do this in Node?”. Another common question is one that is obviously a homework assignment.


Looks like you found the magic ticket if you ask me. I wouldn’t bat an eye about that being too low level or breaking api change. A new editor could come out tomorrow that would replace Atom for us!

I was worried about some direct DOM prop changes I made in my code, months ago. Haven’t seen an issue since.

I’ll just throw this out there for fun. When I was working on a sublime version of Jumpy I had some weird similar issues with buffer. At some point I was overlaying a file, naming and saving a temp file was a trick, not a good one. I then ended up getting rid of that overlay and doing inline edits, but I fortunately could run the undo command and it would not prompt me for saves if I remember correctly. What I really wanted was a way to do things with overlays etc, of course super easy to do in Atom!

Does your new editor need to be a real editor (sounds like it might)? Or can it just be a z-indexed div with read only stuff in it (preferable)? I think that’s the better approach if your plugin is doing a read only overlay / display of info. I remember your read only editor question from a while back, so I might be blurring the expected behavior here…


I’m bringing in old versions of code to one editor tab. Once there, the user can do whatever they want. Of course copying from it to paste in the current code is the most common usage but even then having syntax colorized is awesome. Then there is find/replace and the list goes on. So keeping it a full editor works great.

But changes to past versions are problematic. We don’t want to rip a hole in the space-time continuum. So when they start to edit an old version a warning comes up that lets them continue editing, undo the edit in progress, or go to the current source. They are also warned that all edits will be lost.


Ah, I see very cool. There’s a vim plugin that does some crazy awesome buffer stuff like this. I can’t remember if this one is the one:

If it is, it comes bundled with janus which you can install from here:

It might be worth checking out how they do it. I skimmed it, but not sure that’s the same plugin for vim that is very similar to some of the stuff you’re describing. I was just discussing MS Word version highlighting functionality recently coincidentally. Maybe you can steal some hints? That’s a pretty mature feature, at least 11 years old.