Add 'before-save-hook 'delete-trailing-whitespace