;;; 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.
;;
;; 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
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
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
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'."
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
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'."
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"
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
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
(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
((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)
(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
(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)))
(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)