Fix up spurious execute-bit on net/tramp.el
[bpt/emacs.git] / lisp / whitespace.el
index 030d5f7..183698a 100644 (file)
@@ -1,12 +1,12 @@
 ;;; whitespace.el --- minor mode to visualize TAB, (HARD) SPACE, NEWLINE
 
-;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 ;;   Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
 ;; Keywords: data, wp
-;; Version: 12
+;; Version: 12.1
 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
 
 ;; This file is part of GNU Emacs.
 ;; characters over the default mechanism of `nobreak-char-display'
 ;; (which see) and `show-trailing-whitespace' (which see).
 ;;
+;; The trailing spaces are not highlighted while point is at end of line.
+;; Also the spaces at beginning of buffer are not highlighted while point is at
+;; beginning of buffer; and the spaces at end of buffer are not highlighted
+;; while point is at end of buffer.
+;;
 ;; There are two ways of using whitespace: local and global.
 ;;
 ;; * Local whitespace affects only the current buffer.
@@ -85,7 +90,7 @@
 ;;
 ;; To use whitespace, insert in your ~/.emacs:
 ;;
-;;    (require 'whitespace-mode)
+;;    (require 'whitespace)
 ;;
 ;; Or autoload at least one of the commands`whitespace-mode',
 ;; `whitespace-toggle-options', `global-whitespace-mode' or
@@ -392,14 +397,14 @@ It's a list containing some or all of the following values:
    spaces              SPACEs and HARD SPACEs are visualized via
                        faces.
 
-   lines               lines whose have columns beyond
+   lines               lines which have columns beyond
                        `whitespace-line-column' are highlighted via
-                       faces .
+                       faces.
                        Whole line is highlighted.
                        It has precedence over `lines-tail' (see
                        below).
 
-   lines-tail          lines whose have columns beyond
+   lines-tail          lines which have columns beyond
                        `whitespace-line-column' are highlighted via
                        faces.
                        But only the part of line which goes
@@ -457,7 +462,7 @@ Any other value is ignored.
 If nil, don't visualize TABs, (HARD) SPACEs and NEWLINEs via faces and
 via display table.
 
-There is an evaluation order for some values, if some values are
+There is an evaluation order for some values, if they are
 included in `whitespace-style' list.  For example, if
 indentation, indentation::tab and/or indentation::space are
 included in `whitespace-style' list.  The evaluation order for
@@ -1017,7 +1022,6 @@ Any other value is treated as nil."
 If ARG is null, toggle whitespace visualization.
 If ARG is a number greater than zero, turn on visualization;
 otherwise, turn off visualization.
-Only useful with a windowing system.
 
 See also `whitespace-style', `whitespace-newline' and
 `whitespace-display-mappings'."
@@ -1042,7 +1046,6 @@ See also `whitespace-style', `whitespace-newline' and
 If ARG is null, toggle NEWLINE visualization.
 If ARG is a number greater than zero, turn on visualization;
 otherwise, turn off visualization.
-Only useful with a windowing system.
 
 Use `whitespace-newline-mode' only for NEWLINE visualization
 exclusively.  For other visualizations, including NEWLINE
@@ -1071,7 +1074,6 @@ See also `whitespace-newline' and `whitespace-display-mappings'."
 If ARG is null, toggle whitespace visualization.
 If ARG is a number greater than zero, turn on visualization;
 otherwise, turn off visualization.
-Only useful with a windowing system.
 
 See also `whitespace-style', `whitespace-newline' and
 `whitespace-display-mappings'."
@@ -1128,12 +1130,11 @@ See also `whitespace-style', `whitespace-newline' and
 If ARG is null, toggle NEWLINE visualization.
 If ARG is a number greater than zero, turn on visualization;
 otherwise, turn off visualization.
-Only useful with a windowing system.
 
 Use `global-whitespace-newline-mode' only for NEWLINE
 visualization exclusively.  For other visualizations, including
 NEWLINE visualization together with (HARD) SPACEs and/or TABs,
-please, use `global-whitespace-mode'.
+please use `global-whitespace-mode'.
 
 See also `whitespace-newline' and `whitespace-display-mappings'."
   :lighter    " NL"
@@ -1294,8 +1295,6 @@ The valid symbols are:
 
    whitespace-style    restore `whitespace-style' value
 
-Only useful with a windowing system.
-
 See `whitespace-style' and `indent-tabs-mode' for documentation."
   (interactive (whitespace-interactive-char t))
   (let ((whitespace-style
@@ -1373,8 +1372,6 @@ The valid symbols are:
 
    whitespace-style    restore `whitespace-style' value
 
-Only useful with a windowing system.
-
 See `whitespace-style' and `indent-tabs-mode' for documentation."
   (interactive (whitespace-interactive-char nil))
   (let ((whitespace-style
@@ -1945,8 +1942,7 @@ cleaning up these problems."
   (unless (get-buffer whitespace-help-buffer-name)
     (delete-other-windows)
     (let ((buffer (get-buffer-create whitespace-help-buffer-name)))
-      (save-excursion
-       (set-buffer buffer)
+      (with-current-buffer buffer
        (erase-buffer)
        (insert whitespace-help-text)
        (whitespace-insert-option-mark
@@ -2050,7 +2046,7 @@ See also `whitespace-toggle-option-alist'."
        ((quit error)
         (whitespace-help-off)
         (error (error-message-string data)))))
-    (list sym)))                       ; return the apropriate symbol
+    (list sym)))                       ; return the appropriate symbol
 
 
 (defun whitespace-toggle-list (local-p arg the-list)
@@ -2310,7 +2306,7 @@ resultant list will be returned."
 
 
 (defun whitespace-trailing-regexp (limit)
-  "Match trailing spaces which does not contain the point at end of line."
+  "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)
               (save-match-data
@@ -2320,14 +2316,14 @@ resultant list will be returned."
 
 
 (defun whitespace-empty-at-bob-regexp (limit)
-  "Match spaces at beginning of buffer which does not contain the point at \
+  "Match spaces at beginning of buffer which do not contain the point at \
 beginning of buffer."
   (and (/= whitespace-point 1)
        (re-search-forward whitespace-empty-at-bob-regexp limit t)))
 
 
 (defun whitespace-empty-at-eob-regexp (limit)
-  "Match spaces at end of buffer which does not contain the point at end of \
+  "Match spaces at end of buffer which do not contain the point at end of \
 buffer."
   (and (/= whitespace-point (1+ (buffer-size)))
        (re-search-forward whitespace-empty-at-eob-regexp limit t)))
@@ -2392,6 +2388,10 @@ 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
+      ;; when two or more windows are visible.
+      (set (make-local-variable 'buffer-display-table)
+          (copy-sequence buffer-display-table))
       (unless buffer-display-table
        (setq buffer-display-table (make-display-table)))
       (dolist (entry whitespace-display-mappings)