Prevent Emacs from touching your whitespace

I’m modifying some existing code (PHP, uggh) that is not that well laid out. There is judicious use of both tabs and spaces. Indentation is a mess.

Emacs helpfully corrects all that automatically; which would be cool 99% of the time. In this case, all this automatic cleanup screws up the diffs for my version control. I need to keep my patches as clean as possible.

A temporary hack to work around this:

;; temporary hacks
(defun delete-trailing-whitespace () 
  (interactive))

(defun untabify (start end) 
  (interactive))

(setq standard-indent 8)
(setq-default indent-tabs-mode 1)

Redefining standard functions is a backwards way to solve this, and I’m sure there are variables somewhere that controls these settings, but I just couldn’t find them.