https://github.com/lewang/ws-butler.git
git clone 'git://github.com/lewang/ws-butler.git'
Only lines touched get trimmed. If the white space at end of buffer is
changed, then blank lines at the end of buffer are truncated respecting
require-final-newline
.
Trimming only happens when saving.
The user is not made explicitly aware when trimming happens. You keep working and the butler takes care of whitespace for you.
This means if point is at a location that was trimmed, point is not moved, but the data on disk has been cleaned up (revert the buffer to confirm).
By default, ws-butler preserves “virtual spaces” in front of point if necessary. The file on disk is cleaned up however.
This can be disabled with ws-butler-keep-whitespace-before-point
.
I started by trimming all spaces at EOL in source code in a “write-file-hook” when I started programming. It seemed like a great idea.
post-command-hook
and trims white space while you
edit.post-command-hook
.I started experimenting with using highlight-changes-mode
to trim only
lines I touch on save.
Now, the dependency on highlight-changes-mode
has been removed and we
handle change changing through text properties ourselves.