Sublime Forum

Possible to mark a buffer as clean? or to save a buffer?

#1

I am writing a plugin that makes modifications to the buffer before the document is saved, then removes the modifications after the document is saved. The downside to this is that when the user closes the document after saving, it is dirty, so it displays the unsaved changes dialogue. I wonder if I can a) save the buffer whenever I want instead of waiting for the user to save or b) mark the dirty document as clean after my modification to the document is complete.

Any ideas? Thanks.

0 Likes

#2

Unfortunately the only thing to do is work around this API hole. If you mark a buffer as scratch, then it never shows as dirty. So what I would do is mark it as scratch in on_post_save, then unmark it as scratch the first time they modify it.

0 Likes

#3

Perfect, thanks. Got it implemented :smiley:

0 Likes