Subject: whitespace.el: whitespace-cleanup does not clean spaces before tabs

From: Jeff Dairiki <[email-masked]>
Date: Tue, 7 Dec 2010 09:34:26 -0800

`whitespace-cleanup-region' in whitespace.el (version 13.1) does not
clean up spaces before tabs if either:

 - `space-before-tab' is in `whitespace-style' and `indent-tabs-mode'
   non-nil

 - `space-before-tab::tab' is in `whitespace-style'.

Here's a patch (on whitespace.el version 13.1) which fixes the problem
for me.

diff --git a/site-lisp/whitespace.el b/site-lisp/whitespace.el
index a9fec09..5f5e822 100644
--- a/site-lisp/whitespace.el
+++ b/site-lisp/whitespace.el
@@ -1700,12 +1700,12 @@ documentation."
            (whitespace-replace-action
             (if whitespace-indent-tabs-mode 'tabify 'untabify)
             rstart rend whitespace-space-before-tab-regexp
-            (if whitespace-indent-tabs-mode 1 2)))
+            (if whitespace-indent-tabs-mode 0 2)))
           ;; ACTION: replace SPACEs before TAB by TABs.
           ((memq 'space-before-tab::tab whitespace-style)
            (whitespace-replace-action
             'tabify rstart rend
-            whitespace-space-before-tab-regexp 1))
+            whitespace-space-before-tab-regexp 0))
           ;; ACTION: replace TABs by SPACEs.
           ((memq 'space-before-tab::space whitespace-style)
            (whitespace-replace-action

Thanks for everything!

Jeff