]> code.delx.au - gnu-emacs/blobdiff - lisp/whitespace.el
Fix changes in 2012-04-09T18:12:40Z!schwab@linux-m68k.org.
[gnu-emacs] / lisp / whitespace.el
index 3cbc41e84c050aeaa0e7ee481862f34339ac334e..e752dc56553c12add488afe5109cb6bcae6c70db 100644 (file)
@@ -1,6 +1,6 @@
 ;;; whitespace.el --- minor mode to visualize TAB, (HARD) SPACE, NEWLINE
 
-;; Copyright (C) 2000-2011  Free Software Foundation, Inc.
+;; Copyright (C) 2000-2012  Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
@@ -525,7 +525,7 @@ evaluated instead of indentation::space value.
 
 One reason for not visualize spaces via faces (if `face' is not
 included in `whitespace-style') is to use exclusively for
-cleanning up a buffer.  See `whitespace-cleanup' and
+cleaning up a buffer.  See `whitespace-cleanup' and
 `whitespace-cleanup-region' for documentation.
 
 See also `whitespace-display-mappings' for documentation."
@@ -623,8 +623,12 @@ and `newline'."
 (defface whitespace-newline
   '((((class color) (background dark))
      (:foreground "darkgray" :bold nil))
-    (((class color) (background light))
+    (((class color) (min-colors 88) (background light))
      (:foreground "lightgray" :bold nil))
+    ;; Displays with 16 colors use lightgray as background, so using a
+    ;; lightgray foreground makes the newline mark invisible.
+    (((class color) (background light))
+     (:foreground "brown" :bold nil))
     (t (:underline t :bold nil)))
   "Face used to visualize NEWLINE char mapping.
 
@@ -1102,12 +1106,9 @@ See also `whitespace-newline' and `whitespace-display-mappings'."
   :init-value nil
   :global     nil
   :group      'whitespace
-  (cond
-   (whitespace-newline-mode
-    (let ((whitespace-style '(face newline-mark newline)))
-      (whitespace-mode whitespace-newline-mode)))
-   (t
-    (whitespace-mode -1)))
+  (let ((whitespace-style '(face newline-mark newline)))
+    (whitespace-mode (if whitespace-newline-mode
+                        1 -1)))
   ;; sync states (running a batch job)
   (setq whitespace-newline-mode whitespace-mode))
 
@@ -2411,8 +2412,8 @@ resultant list will be returned."
   "Match trailing spaces which do not contain the point at end of line."
   (let ((status t))
     (while (if (re-search-forward whitespace-trailing-regexp limit t)
-               (= whitespace-point (match-end 1)) ;; Loop if point at eol.
-            (setq status nil)))                  ;; End of buffer.
+              (= whitespace-point (match-end 1)) ;; loop if point at eol
+            (setq status nil)))                  ;; end of buffer
     status))
 
 
@@ -2576,7 +2577,7 @@ Also refontify when necessary."
        (setq whitespace-display-table-was-local t
              whitespace-display-table
              (copy-sequence buffer-display-table))
-       ;; asure `buffer-display-table' is unique
+       ;; Assure `buffer-display-table' is unique
        ;; when two or more windows are visible.
        (setq buffer-display-table
              (copy-sequence buffer-display-table)))