Re: Save and strip whitespace
On 01/04/2012, at 15:48, John Yeates wrote:
> This bundle seems to have stopped working in build 9110: it doesn’t strip space in the buffer or saved
file any more. Has anything changed that would cause the callback.document.did-save hook to stop working?
I'm starting to think it never actually worked properly...
Here's how the bundle works on my end (with 9110, on 10.7.3):
- Open a document
- Add some trailing whitespace
- Hit 'Save'
- The trailing whitespace is removed, and the file *seems* to be saved
I say "seems", because the document icon goes from semitransparent to opaque, but what TextMate is saving
is actually the file *with* the whitespace.
The command's semantic class is 'callback.document.did-save' and is set to Save: 'Current Document'
(see attached screenshot)
It looks like it first saves the document, and then it runs the command (makes sense, but then we need a new
semantic class: 'callback.document.before-save'). Still, there is a bug with TM2, as it doesn't show
the document as modified after running the command.
I've gotten used to hitting Command + S two times in a row to remove whitespace and have it saved on disk, but
it's a pretty crappy solution and doesn't actually solve the problem when using the 'Save on Focus Lost' bundle.