How to disable "do you want to save" dialog?


#1

Hi everyone,

Is there a way for a package to disable the " has changes; do you want to save them?" dialog from popping up when the user attempts to close an unsaved editor?

The package I’ve been working on, atom-slime, implements a Lisp interpreter / shell, and is implemented over a standard text editor. As such, it isn’t a normal file that should be saved, so it would be great for my package to be able to disable this dialog.

Any advice would be very much appreciated - thanks!


#2

There isn’t a built-in way to do this. But I would take a look at the implementation behind TextBuffer.isModified() to see if there is a way that you could mark the buffer as unmodified after something changes. This would fool Atom into not showing the save dialog.


#3

Clever! Setting that TextBuffer instance’s isModified method to a function that always returns false seems to do the trick.

Thanks for your help!