Home Download Buy Blog Forum Support

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

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

Postby rDr4g0n on Tue Aug 27, 2013 6:19 pm

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.
rDr4g0n
 
Posts: 7
Joined: Tue Aug 27, 2013 6:11 pm

Re: possible to mark a buffer as clean? or to save a buffer?

Postby adzenith on Wed Aug 28, 2013 1:50 pm

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.
adzenith
 
Posts: 1204
Joined: Mon Oct 19, 2009 9:12 pm

Re: possible to mark a buffer as clean? or to save a buffer?

Postby rDr4g0n on Wed Aug 28, 2013 2:11 pm

Perfect, thanks. Got it implemented :D
rDr4g0n
 
Posts: 7
Joined: Tue Aug 27, 2013 6:11 pm


Return to Plugin Development

Who is online

Users browsing this forum: Alexa [Bot] and 2 guests