(modeline-highlight): Rename from (the erroneous) `modeline-higilight'.
[bpt/emacs.git] / lisp / whitespace.el
index 4406a06..a119793 100644 (file)
@@ -86,7 +86,7 @@
 
 ;;; Code:
 
-(defvar whitespace-version "3.4" "Version of the whitespace library.")
+(defvar whitespace-version "3.5" "Version of the whitespace library.")
 
 (defvar whitespace-all-buffer-files nil
   "An associated list of buffers and files checked for whitespace cleanliness.
@@ -307,8 +307,8 @@ To disable timer scans, set this to zero."
   :group 'whitespace)
 
 (defcustom whitespace-display-spaces-in-color t
-  "Display the bogus whitespaces by coloring them with
-`whitespace-highlight-face'."
+  "Display the bogus whitespaces by coloring them with the face
+`whitespace-highlight'."
   :type 'boolean
   :group 'whitespace)
 
@@ -318,18 +318,20 @@ To disable timer scans, set this to zero."
   :group 'whitespace
   :group 'faces)
 
-(defface whitespace-highlight-face '((((class color) (background light))
-                                     (:background "green1"))
-                                    (((class color) (background dark))
-                                     (:background "sea green"))
-                                    (((class grayscale mono)
-                                      (background light))
-                                     (:background "black"))
-                                    (((class grayscale mono)
-                                      (background dark))
-                                     (:background "white")))
+(defface whitespace-highlight '((((class color) (background light))
+                                (:background "green1"))
+                               (((class color) (background dark))
+                                (:background "sea green"))
+                               (((class grayscale mono)
+                                 (background light))
+                                (:background "black"))
+                               (((class grayscale mono)
+                                 (background dark))
+                                (:background "white")))
   "Face used for highlighting the bogus whitespaces that exist in the buffer."
   :group 'whitespace-faces)
+;; backward-compatibility alias
+(put 'whitespace-highlight-face 'face-alias 'whitespace-highlight)
 
 (if (not (assoc 'whitespace-mode minor-mode-alist))
     (setq minor-mode-alist (cons '(whitespace-mode whitespace-mode-line)
@@ -599,7 +601,7 @@ whitespace problems."
       (setq pmax (point))
       (if (equal pmin pmax)
          (progn
-           (whitespace-highlight-the-space pmin pmax)
+           (whitespace-highlight-the-space pmin (1+ pmax))
            t)
        nil))))
 
@@ -637,7 +639,7 @@ whitespace problems."
            (setq pmax (point))
            (if (equal pmin pmax)
                (progn
-                 (whitespace-highlight-the-space pmin pmax)
+                 (whitespace-highlight-the-space (- pmin 1) pmax)
                  t)
              nil))
        nil))))
@@ -733,12 +735,11 @@ Also with whitespaces whose testing has been turned off."
   "Highlight the current line, unhighlighting a previously jumped to line."
   (if whitespace-display-spaces-in-color
       (let ((ol (whitespace-make-overlay b e)))
-       (whitespace-unhighlight-the-space)
        (push ol whitespace-highlighted-space)
-       (whitespace-overlay-put ol 'face 'whitespace-highlight-face))))
+       (whitespace-overlay-put ol 'face 'whitespace-highlight))))
 ;;  (add-hook 'pre-command-hook 'whitespace-unhighlight-the-space))
 
-(defun whitespace-unhighlight-the-space ()
+(defun whitespace-unhighlight-the-space()
   "Unhighlight the currently highlight line."
   (if (and whitespace-display-spaces-in-color whitespace-highlighted-space)
       (progn