Sublime Forum

[Solved] Close unsaved view without prompt

#1

I believed to close an unsaved view without be prompted, you should do this:

window = sublime.active_window()
view = window.active_view()

view.set_scratch(True)
window.run_command('close')

but I keep seeing the window asking to save the file.

Did I miss something?

0 Likes

#2

That seems to work OK for me (see below); I tried it across Windows, Linux and MacOS using Sublime text 3 and build 3114. What version/OS are you trying this on?

0 Likes

#3

Thanks @OdatNurd
Checking a little more deeper I found another plugin doing

if (self.view.is_dirty()):
    self.view.run_command('save')

It was happening before my plugin. After disable it, it worked as supposed to work

2 Likes