;;; 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>
;; There are also the following useful commands:
;;
;; `whitespace-newline-mode'
-;; Toggle NEWLINE minor mode visualization ("nl" on modeline).
+;; Toggle NEWLINE minor mode visualization ("nl" on mode line).
;;
;; `global-whitespace-newline-mode'
-;; Toggle NEWLINE global minor mode visualization ("NL" on modeline).
+;; Toggle NEWLINE global minor mode visualization ("NL" on mode line).
;;
;; `whitespace-report'
;; Report some blank problems in buffer.
;; buffer is visited or written.
;;
;;
-;; Acknowledgements
-;; ----------------
+;; Acknowledgments
+;; ---------------
;;
;; Thanks to felix (EmacsWiki) for keeping highlight when switching between
;; major modes on a file.
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."
(defface whitespace-space
'((((class color) (background dark))
- (:background "grey20" :foreground "darkgray"))
+ :background "grey20" :foreground "darkgray")
(((class color) (background light))
- (:background "LightYellow" :foreground "lightgray"))
- (t (:inverse-video t)))
+ :background "LightYellow" :foreground "lightgray")
+ (t :inverse-video t))
"Face used to visualize SPACE."
:group 'whitespace)
(defface whitespace-hspace ; 'nobreak-space
'((((class color) (background dark))
- (:background "grey24" :foreground "darkgray"))
+ :background "grey24" :foreground "darkgray")
(((class color) (background light))
- (:background "LemonChiffon3" :foreground "lightgray"))
- (t (:inverse-video t)))
+ :background "LemonChiffon3" :foreground "lightgray")
+ (t :inverse-video t))
"Face used to visualize HARD SPACE."
:group 'whitespace)
(defface whitespace-tab
'((((class color) (background dark))
- (:background "grey22" :foreground "darkgray"))
+ :background "grey22" :foreground "darkgray")
(((class color) (background light))
- (:background "beige" :foreground "lightgray"))
- (t (:inverse-video t)))
+ :background "beige" :foreground "lightgray")
+ (t :inverse-video t))
"Face used to visualize TAB."
:group 'whitespace)
(defface whitespace-newline
- '((((class color) (background dark))
- (:foreground "darkgray" :bold nil))
- (((class color) (background light))
- (:foreground "lightgray" :bold nil))
- (t (:underline t :bold nil)))
+ '((default :weight normal)
+ (((class color) (background dark)) :foreground "darkgray")
+ (((class color) (min-colors 88) (background light)) :foreground "lightgray")
+ ;; Displays with 16 colors use lightgray as background, so using a
+ ;; lightgray foreground makes the newline mark invisible.
+ (((class color) (background light)) :foreground "brown")
+ (t :underline t))
"Face used to visualize NEWLINE char mapping.
See `whitespace-display-mappings'."
(defface whitespace-trailing ; 'trailing-whitespace
- '((((class mono)) (:inverse-video t :bold t :underline t))
- (t (:background "red1" :foreground "yellow" :bold t)))
+ '((default :weight bold)
+ (((class mono)) :inverse-video t :underline t)
+ (t :background "red1" :foreground "yellow"))
"Face used to visualize trailing blanks."
:group 'whitespace)
(defface whitespace-line
- '((((class mono)) (:inverse-video t :bold t :underline t))
- (t (:background "gray20" :foreground "violet")))
+ '((((class mono)) :inverse-video t :weight bold :underline t)
+ (t :background "gray20" :foreground "violet"))
"Face used to visualize \"long\" lines.
See `whitespace-line-column'."
(defface whitespace-space-before-tab
- '((((class mono)) (:inverse-video t :bold t :underline t))
- (t (:background "DarkOrange" :foreground "firebrick")))
+ '((((class mono)) :inverse-video t :weight bold :underline t)
+ (t :background "DarkOrange" :foreground "firebrick"))
"Face used to visualize SPACEs before TAB."
:group 'whitespace)
(defface whitespace-indentation
- '((((class mono)) (:inverse-video t :bold t :underline t))
- (t (:background "yellow" :foreground "firebrick")))
+ '((((class mono)) :inverse-video t :weight bold :underline t)
+ (t :background "yellow" :foreground "firebrick"))
"Face used to visualize 8 or more SPACEs at beginning of line."
:group 'whitespace)
(defface whitespace-empty
- '((((class mono)) (:inverse-video t :bold t :underline t))
- (t (:background "yellow" :foreground "firebrick")))
+ '((((class mono)) :inverse-video t :weight bold :underline t)
+ (t :background "yellow" :foreground "firebrick"))
"Face used to visualize empty lines at beginning and/or end of buffer."
:group 'whitespace)
(defface whitespace-space-after-tab
- '((((class mono)) (:inverse-video t :bold t :underline t))
- (t (:background "yellow" :foreground "firebrick")))
+ '((((class mono)) :inverse-video t :weight bold :underline t)
+ (t :background "yellow" :foreground "firebrick"))
"Face used to visualize 8 or more SPACEs after TAB."
:group 'whitespace)
(when (memq 'empty whitespace-style)
(let (overwrite-mode) ; enforce no overwrite
(goto-char (point-min))
- (when (re-search-forward
- (concat "\\`" whitespace-empty-at-bob-regexp) nil t)
+ (when (looking-at whitespace-empty-at-bob-regexp)
(delete-region (match-beginning 1) (match-end 1)))
(when (re-search-forward
(concat whitespace-empty-at-eob-regexp "\\'") nil t)
(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)))