Sometimes I use ST as a go-between for modifying some text from one application in order to paste it into another application. When I do this, I create a New “untitled” and empty document, use ST’s handy tools to modify the text, then Ctrl+A and Ctrl+X to clear the buffer and put everything into the clipboard.
After I do this and try to close the “untitled*” tab, ST thinks it has been modified and asks me if I would like to save it. Of course it has been modified, but it is also empty. What use could I possibly have to name it and keep it if I had not already done so?
My previous editor, Metapad, would only prompt to save the untitled file if it contained text, otherwise it would just close the window.  I don’t know how other editors behave regarding this, but I grew very fond of this behaviour 
 ; anyways tinkering around with onClose was total fail because the prompt to save is triggered before onClose hook gets called. So to do what you want I guess we would have to get a lil clever and just hook onModified and check if the view is empty then make it a scratch (which won’t ever ask to save) if it’s not empty then just do normal prompt before closing. So if your view has any non-whitespace character it will ask to save else close that damn thing.
; anyways tinkering around with onClose was total fail because the prompt to save is triggered before onClose hook gets called. So to do what you want I guess we would have to get a lil clever and just hook onModified and check if the view is empty then make it a scratch (which won’t ever ask to save) if it’s not empty then just do normal prompt before closing. So if your view has any non-whitespace character it will ask to save else close that damn thing.
 didn’t think of that. I personally barely use scratch buffers and if I do I would name them too.
 didn’t think of that. I personally barely use scratch buffers and if I do I would name them too.