Allow configuring cleaning white space on save

This condition is checked when saving if the existing
whitespace-cleanup is set instead of when the when prog-mode is is
entered.  This way it can be over-ridden by either dir-locals or
file-local variables.
A few code cleanup & reorganizations