Sometimes I make whitespace cleanups to source code. I'd like to be certain that I do not accidentally introduce real code changes (let us assume that the programming language is one where removing or adding white space never changes the meaning of code).
Is there a minor mode that sets Emacs to only allow whitespace changes in a particular buffer? So I'd be able to delete white space characters (space, tab, newline etc) and add ones, but not make any other alterations to the buffer content.
(A more advanced mode would allow changes in the length of white space sequences, and allow introducing and deleting it around punctuation characters, but disallow breaking a word token (defined as, say, a sequence of characters in [A-Za-z0-9_]) by adding new spaces in the middle, nor fusing two separate word tokens by deleting the white space that separated them. But this is not essential. Most programming languages will make it pretty obvious if you accidentally change 'int x;' to 'intx;'.)