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.