2008-01-31 16:08:29 +00:00
|
|
|
|
;;; whitespace.el --- minor mode to visualize TAB, (HARD) SPACE, NEWLINE
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
|
|
|
|
;; Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
|
|
;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
|
|
|
|
|
;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
|
|
|
|
|
;; Keywords: data, wp
|
2008-03-01 19:00:24 +00:00
|
|
|
|
;; Version: 9.3
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
|
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
|
|
|
;; it under the terms of the GNU General Public License as published
|
|
|
|
|
;; by the Free Software Foundation; either version 3, or (at your
|
|
|
|
|
;; option) any later version.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful, but
|
|
|
|
|
;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
;; General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
|
|
|
|
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
|
;; Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;
|
|
|
|
|
;; Introduction
|
|
|
|
|
;; ------------
|
|
|
|
|
;;
|
2008-01-21 12:45:58 +00:00
|
|
|
|
;; This package is a minor mode to visualize blanks (TAB, (HARD) SPACE
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; and NEWLINE).
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; whitespace uses two ways to visualize blanks: faces and display
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; table.
|
|
|
|
|
;;
|
|
|
|
|
;; * Faces are used to highlight the background with a color.
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; whitespace uses font-lock to highlight blank characters.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
|
|
|
|
;; * Display table changes the way a character is displayed, that is,
|
|
|
|
|
;; it provides a visual mark for characters, for example, at the end
|
|
|
|
|
;; of line (?\xB6), at SPACEs (?\xB7) and at TABs (?\xBB).
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; The `whitespace-style' and `whitespace-chars' variables are used to
|
|
|
|
|
;; select which way should be used to visualize blanks.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; Note that when whitespace is turned on, whitespace saves the
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; font-lock state, that is, if font-lock is on or off. And
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; whitespace restores the font-lock state when it is turned off. So,
|
|
|
|
|
;; if whitespace is turned on and font-lock is off, whitespace also
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; turns on the font-lock to highlight blanks, but the font-lock will
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; be turned off when whitespace is turned off. Thus, turn on
|
|
|
|
|
;; font-lock before whitespace is on, if you want that font-lock
|
|
|
|
|
;; continues on after whitespace is turned off.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; When whitespace is on, it takes care of highlighting some special
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; characters over the default mechanism of `nobreak-char-display'
|
|
|
|
|
;; (which see) and `show-trailing-whitespace' (which see).
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; There are two ways of using whitespace: local and global.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; * Local whitespace affects only the current buffer.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; * Global whitespace affects all current and future buffers. That
|
|
|
|
|
;; is, if you turn on global whitespace and then create a new
|
|
|
|
|
;; buffer, the new buffer will also have whitespace on. The
|
|
|
|
|
;; `whitespace-global-modes' variable controls which major-mode will
|
|
|
|
|
;; be automagically turned on.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
|
|
|
|
;; You can mix the local and global usage without any conflict. But
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; local whitespace has priority over global whitespace. Whitespace
|
|
|
|
|
;; mode is active in a buffer if you have enabled it in that buffer or
|
|
|
|
|
;; if you have enabled it globally.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; When global and local whitespace are on:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; * if local whitespace is turned off, whitespace is turned off for
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; the current buffer only.
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; * if global whitespace is turned off, whitespace continues on only
|
|
|
|
|
;; in the buffers in which local whitespace is on.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; To use whitespace, insert in your ~/.emacs:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; (require 'whitespace-mode)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; Or autoload at least one of the commands`whitespace-mode',
|
|
|
|
|
;; `whitespace-toggle-options', `global-whitespace-mode' or
|
|
|
|
|
;; `global-whitespace-toggle-options'. For example:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; (autoload 'whitespace-mode "whitespace"
|
|
|
|
|
;; "Toggle whitespace visualization." t)
|
|
|
|
|
;; (autoload 'whitespace-toggle-options "whitespace"
|
|
|
|
|
;; "Toggle local `whitespace-mode' options." t)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; whitespace was inspired by:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;; whitespace.el Rajesh Vaidheeswarran <rv@gnu.org>
|
|
|
|
|
;; Warn about and clean bogus whitespaces in the file
|
|
|
|
|
;; (inspired the idea to warn and clean some blanks)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; This was the original `whitespace.el' which was replaced by
|
|
|
|
|
;; `blank-mode.el'. And later `blank-mode.el' was renamed to
|
|
|
|
|
;; `whitespace.el'.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;;
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; show-whitespace-mode.el Aurelien Tisne <aurelien.tisne@free.fr>
|
|
|
|
|
;; Simple mode to highlight whitespaces
|
|
|
|
|
;; (inspired the idea to use font-lock)
|
|
|
|
|
;;
|
|
|
|
|
;; whitespace-mode.el Lawrence Mitchell <wence@gmx.li>
|
|
|
|
|
;; Major mode for editing Whitespace
|
|
|
|
|
;; (inspired the idea to use display table)
|
|
|
|
|
;;
|
|
|
|
|
;; visws.el Miles Bader <miles@gnu.org>
|
|
|
|
|
;; Make whitespace visible
|
|
|
|
|
;; (handle display table, his code was modified, but the main
|
|
|
|
|
;; idea was kept)
|
|
|
|
|
;;
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; Using whitespace
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; ----------------
|
|
|
|
|
;;
|
|
|
|
|
;; There is no problem if you mix local and global minor mode usage.
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; * LOCAL whitespace:
|
|
|
|
|
;; + To toggle whitespace options locally, type:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; M-x whitespace-toggle-options RET
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; + To activate whitespace locally, type:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; C-u 1 M-x whitespace-mode RET
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; + To deactivate whitespace locally, type:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; C-u 0 M-x whitespace-mode RET
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; + To toggle whitespace locally, type:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; M-x whitespace-mode RET
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; * GLOBAL whitespace:
|
|
|
|
|
;; + To toggle whitespace options globally, type:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; M-x global-whitespace-toggle-options RET
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; + To activate whitespace globally, type:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; C-u 1 M-x global-whitespace-mode RET
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; + To deactivate whitespace globally, type:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; C-u 0 M-x global-whitespace-mode RET
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; + To toggle whitespace globally, type:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; M-x global-whitespace-mode RET
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;; There are also the following useful commands:
|
|
|
|
|
;;
|
2008-03-01 19:00:24 +00:00
|
|
|
|
;; `whitespace-report'
|
|
|
|
|
;; Report some blank problems in buffer.
|
|
|
|
|
;;
|
|
|
|
|
;; `whitespace-report-region'
|
|
|
|
|
;; Report some blank problems in a region.
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-cleanup'
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;; Cleanup some blank problems in all buffer or at region.
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-cleanup-region'
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;; Cleanup some blank problems at region.
|
|
|
|
|
;;
|
|
|
|
|
;; The problems, which are cleaned up, are:
|
|
|
|
|
;;
|
|
|
|
|
;; 1. empty lines at beginning of buffer.
|
|
|
|
|
;; 2. empty lines at end of buffer.
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
;; If `whitespace-chars' includes the value `empty', remove all
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; empty lines at beginning and/or end of buffer.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;;
|
|
|
|
|
;; 3. 8 or more SPACEs at beginning of line.
|
2008-02-01 18:52:51 +00:00
|
|
|
|
;; If `whitespace-chars' includes the value `indentation', replace
|
|
|
|
|
;; 8 or more SPACEs at beginning of line by TABs.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;;
|
|
|
|
|
;; 4. SPACEs before TAB.
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
;; If `whitespace-chars' includes the value `space-before-tab',
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; replace SPACEs by TABs.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;;
|
|
|
|
|
;; 5. SPACEs or TABs at end of line.
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
;; If `whitespace-chars' includes the value `trailing', remove all
|
2008-03-01 19:00:24 +00:00
|
|
|
|
;; SPACEs or TABs at end of line.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;;
|
|
|
|
|
;; 6. 8 or more SPACEs after TAB.
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
;; If `whitespace-chars' includes the value `space-after-tab',
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; replace SPACEs by TABs.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;;
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Hooks
|
|
|
|
|
;; -----
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; whitespace has the following hook variables:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-mode-hook'
|
|
|
|
|
;; It is evaluated always when whitespace is turned on locally.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `global-whitespace-mode-hook'
|
|
|
|
|
;; It is evaluated always when whitespace is turned on globally.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-load-hook'
|
|
|
|
|
;; It is evaluated after whitespace package is loaded.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
|
|
|
|
;;
|
|
|
|
|
;; Options
|
|
|
|
|
;; -------
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; Below it's shown a brief description of whitespace options, please,
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; see the options declaration in the code for a long documentation.
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-style' Specify the visualization style.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-chars' Specify which kind of blank is
|
2008-01-21 12:45:58 +00:00
|
|
|
|
;; visualized.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-space' Face used to visualize SPACE.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-hspace' Face used to visualize HARD SPACE.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-tab' Face used to visualize TAB.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-newline' Face used to visualize NEWLINE char
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; mapping.
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-trailing' Face used to visualize trailing
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; blanks.
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-line' Face used to visualize "long" lines.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-space-before-tab' Face used to visualize SPACEs
|
|
|
|
|
;; before TAB.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-indentation' Face used to visualize 8 or more
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;; SPACEs at beginning of line.
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-empty' Face used to visualize empty lines at
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;; beginning and/or end of buffer.
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-space-after-tab' Face used to visualize 8 or more
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;; SPACEs after TAB.
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-space-regexp' Specify SPACE characters regexp.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-hspace-regexp' Specify HARD SPACE characters regexp.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-tab-regexp' Specify TAB characters regexp.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-trailing-regexp' Specify trailing characters regexp.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-space-before-tab-regexp' Specify SPACEs before TAB
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; regexp.
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-indentation-regexp' Specify regexp for 8 or more
|
|
|
|
|
;; SPACEs at beginning of line.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-empty-at-bob-regexp' Specify regexp for empty lines
|
|
|
|
|
;; at beginning of buffer.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-empty-at-eob-regexp' Specify regexp for empty lines
|
|
|
|
|
;; at end of buffer.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-space-after-tab-regexp' Specify regexp for 8 or more
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;; SPACEs after TAB.
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-line-column' Specify column beyond which the line
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; is highlighted.
|
|
|
|
|
;;
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; `whitespace-display-mappings' Specify an alist of mappings
|
|
|
|
|
;; for displaying characters.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-02-01 18:52:51 +00:00
|
|
|
|
;; `whitespace-global-modes' Modes for which global
|
|
|
|
|
;; `whitespace-mode' is automagically
|
|
|
|
|
;; turned on.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
2008-03-01 19:00:24 +00:00
|
|
|
|
;; `whitespace-action' Specify which action is taken when a
|
|
|
|
|
;; buffer is visited, killed or written.
|
|
|
|
|
;;
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Acknowledgements
|
|
|
|
|
;; ----------------
|
|
|
|
|
;;
|
2008-03-01 19:00:24 +00:00
|
|
|
|
;; Thanks to Eric Cooper <ecc@cmu.edu> for the suggestion to have hook actions
|
|
|
|
|
;; when buffer is written or killed as the original whitespace package had.
|
|
|
|
|
;;
|
2008-01-26 01:47:21 +00:00
|
|
|
|
;; Thanks to nschum (EmacsWiki) for the idea about highlight "long"
|
|
|
|
|
;; lines tail. See EightyColumnRule (EmacsWiki).
|
|
|
|
|
;;
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; Thanks to Juri Linkov <juri@jurta.org> for suggesting:
|
|
|
|
|
;; * `define-minor-mode'.
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; * `global-whitespace-*' name for global commands.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Thanks to Robert J. Chassell <bob@gnu.org> for doc fix and testing.
|
|
|
|
|
;;
|
|
|
|
|
;; Thanks to Drew Adams <drew.adams@oracle.com> for toggle commands
|
|
|
|
|
;; suggestion.
|
|
|
|
|
;;
|
|
|
|
|
;; Thanks to Antti Kaihola <antti.kaihola@linux-aktivaattori.org> for
|
|
|
|
|
;; helping to fix `find-file-hooks' reference.
|
|
|
|
|
;;
|
|
|
|
|
;; Thanks to Andreas Roehler <andreas.roehler@easy-emacs.de> for
|
|
|
|
|
;; indicating defface byte-compilation warnings.
|
|
|
|
|
;;
|
|
|
|
|
;; Thanks to TimOCallaghan (EmacsWiki) for the idea about highlight
|
2008-01-26 01:47:21 +00:00
|
|
|
|
;; "long" lines. See EightyColumnRule (EmacsWiki).
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Thanks to Yanghui Bian <yanghuibian@gmail.com> for indicating a new
|
|
|
|
|
;; newline character mapping.
|
|
|
|
|
;;
|
|
|
|
|
;; Thanks to Pete Forman <pete.forman@westgeo.com> for indicating
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; whitespace-mode.el on XEmacs.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Thanks to Miles Bader <miles@gnu.org> for handling display table via
|
|
|
|
|
;; visws.el (his code was modified, but the main idea was kept).
|
|
|
|
|
;;
|
|
|
|
|
;; Thanks to:
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; Rajesh Vaidheeswarran <rv@gnu.org> (original) whitespace.el
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; Aurelien Tisne <aurelien.tisne@free.fr> show-whitespace-mode.el
|
|
|
|
|
;; Lawrence Mitchell <wence@gmx.li> whitespace-mode.el
|
|
|
|
|
;; Miles Bader <miles@gnu.org> visws.el
|
|
|
|
|
;; And to all people who contributed with them.
|
|
|
|
|
;;
|
|
|
|
|
;;
|
|
|
|
|
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
;;; code:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;;; User Variables:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Interface to the command system
|
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defgroup whitespace nil
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"Visualize blanks (TAB, (HARD) SPACE and NEWLINE)."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:link '(emacs-library-link :tag "Source Lisp File" "whitespace.el")
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
:version "23.1"
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:group 'wp
|
|
|
|
|
:group 'data)
|
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-style '(mark color)
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"*Specify the visualization style.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
It's a list containing some or all of the following values:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
mark display mappings are visualized.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
color faces are visualized.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
Any other value is ignored.
|
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
If nil, don't visualize TABs, (HARD) SPACEs and NEWLINEs.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
See also `whitespace-display-mappings' for documentation."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type '(repeat :tag "Style of Blank"
|
|
|
|
|
(choice :tag "Style of Blank"
|
|
|
|
|
(const :tag "Display Table" mark)
|
|
|
|
|
(const :tag "Faces" color)))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-chars
|
2008-01-25 14:09:57 +00:00
|
|
|
|
'(tabs spaces trailing lines space-before-tab newline
|
|
|
|
|
indentation empty space-after-tab)
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"*Specify which kind of blank is visualized.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
It's a list containing some or all of the following values:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
trailing trailing blanks are visualized.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
tabs TABs are visualized.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
spaces SPACEs and HARD SPACEs are visualized.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-26 01:47:21 +00:00
|
|
|
|
lines lines whose have columns beyond
|
2008-01-31 16:08:29 +00:00
|
|
|
|
`whitespace-line-column' are highlighted.
|
2008-01-26 01:47:21 +00:00
|
|
|
|
Whole line is highlighted.
|
|
|
|
|
It has precedence over
|
|
|
|
|
`lines-tail' (see below).
|
|
|
|
|
|
|
|
|
|
lines-tail lines whose have columns beyond
|
2008-01-31 16:08:29 +00:00
|
|
|
|
`whitespace-line-column' are highlighted.
|
2008-01-26 01:47:21 +00:00
|
|
|
|
But only the part of line which goes
|
2008-01-31 16:08:29 +00:00
|
|
|
|
beyond `whitespace-line-column' column.
|
2008-01-26 01:47:21 +00:00
|
|
|
|
It has effect only if `lines' (see above)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
is not present in `whitespace-chars'.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
space-before-tab SPACEs before TAB are visualized.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
newline NEWLINEs are visualized.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-25 14:09:57 +00:00
|
|
|
|
indentation 8 or more SPACEs at beginning of line are
|
|
|
|
|
visualized.
|
|
|
|
|
|
|
|
|
|
empty empty lines at beginning and/or end of buffer
|
|
|
|
|
are visualized.
|
|
|
|
|
|
|
|
|
|
space-after-tab 8 or more SPACEs after a TAB are visualized.
|
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
Any other value is ignored.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
If nil, don't visualize TABs, (HARD) SPACEs and NEWLINEs.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color'.
|
|
|
|
|
Used also when `whitespace-chars' includes `newline',
|
|
|
|
|
and `whitespace-style' includes `mark'."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type '(repeat :tag "Kind of Blank"
|
|
|
|
|
(choice :tag "Kind of Blank"
|
|
|
|
|
(const :tag "Trailing TABs, SPACEs and HARD SPACEs"
|
|
|
|
|
trailing)
|
|
|
|
|
(const :tag "SPACEs and HARD SPACEs" spaces)
|
|
|
|
|
(const :tag "TABs" tabs)
|
|
|
|
|
(const :tag "Lines" lines)
|
|
|
|
|
(const :tag "SPACEs before TAB"
|
|
|
|
|
space-before-tab)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
(const :tag "NEWLINEs" newline)
|
|
|
|
|
(const :tag "Indentation SPACEs" indentation)
|
|
|
|
|
(const :tag "Empty Lines At BOB And/Or EOB"
|
|
|
|
|
empty)
|
|
|
|
|
(const :tag "SPACEs after TAB"
|
|
|
|
|
space-after-tab)))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-space 'whitespace-space
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"*Symbol face used to visualize SPACE.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color'."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type 'face
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defface whitespace-space
|
2008-01-17 12:46:55 +00:00
|
|
|
|
'((((class color) (background dark))
|
|
|
|
|
(:background "grey20" :foreground "aquamarine3"))
|
|
|
|
|
(((class color) (background light))
|
|
|
|
|
(:background "LightYellow" :foreground "aquamarine3"))
|
|
|
|
|
(t (:inverse-video t)))
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"Face used to visualize SPACE."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-hspace 'whitespace-hspace
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"*Symbol face used to visualize HARD SPACE.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color'."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type 'face
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defface whitespace-hspace ; 'nobreak-space
|
2008-01-17 12:46:55 +00:00
|
|
|
|
'((((class color) (background dark))
|
|
|
|
|
(:background "grey24" :foreground "aquamarine3"))
|
|
|
|
|
(((class color) (background light))
|
|
|
|
|
(:background "LemonChiffon3" :foreground "aquamarine3"))
|
|
|
|
|
(t (:inverse-video t)))
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"Face used to visualize HARD SPACE."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-tab 'whitespace-tab
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"*Symbol face used to visualize TAB.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color'."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type 'face
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defface whitespace-tab
|
2008-01-17 12:46:55 +00:00
|
|
|
|
'((((class color) (background dark))
|
|
|
|
|
(:background "grey22" :foreground "aquamarine3"))
|
|
|
|
|
(((class color) (background light))
|
|
|
|
|
(:background "beige" :foreground "aquamarine3"))
|
|
|
|
|
(t (:inverse-video t)))
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"Face used to visualize TAB."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-newline 'whitespace-newline
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"*Symbol face used to visualize NEWLINE char mapping.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
See `whitespace-display-mappings'.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the values `mark'
|
|
|
|
|
and `color', and `whitespace-chars' includes `newline'."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type 'face
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defface whitespace-newline
|
2008-01-17 12:46:55 +00:00
|
|
|
|
'((((class color) (background dark))
|
|
|
|
|
(:background "grey26" :foreground "aquamarine3" :bold t))
|
|
|
|
|
(((class color) (background light))
|
|
|
|
|
(:background "linen" :foreground "aquamarine3" :bold t))
|
|
|
|
|
(t (:bold t :underline t)))
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"Face used to visualize NEWLINE char mapping.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
See `whitespace-display-mappings'."
|
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-trailing 'whitespace-trailing
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"*Symbol face used to visualize traling blanks.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color'."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type 'face
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defface whitespace-trailing ; 'trailing-whitespace
|
2008-01-17 12:46:55 +00:00
|
|
|
|
'((((class mono)) (:inverse-video t :bold t :underline t))
|
|
|
|
|
(t (:background "red1" :foreground "yellow" :bold t)))
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"Face used to visualize trailing blanks."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-line 'whitespace-line
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"*Symbol face used to visualize \"long\" lines.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
See `whitespace-line-column'.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color'."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type 'face
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defface whitespace-line
|
2008-01-17 12:46:55 +00:00
|
|
|
|
'((((class mono)) (:inverse-video t :bold t :underline t))
|
|
|
|
|
(t (:background "gray20" :foreground "violet")))
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"Face used to visualize \"long\" lines.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
See `whitespace-line-column'."
|
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-space-before-tab 'whitespace-space-before-tab
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"*Symbol face used to visualize SPACEs before TAB.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color'."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type 'face
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defface whitespace-space-before-tab
|
2008-01-17 12:46:55 +00:00
|
|
|
|
'((((class mono)) (:inverse-video t :bold t :underline t))
|
|
|
|
|
(t (:background "DarkOrange" :foreground "firebrick")))
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"Face used to visualize SPACEs before TAB."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-indentation 'whitespace-indentation
|
2008-01-25 14:09:57 +00:00
|
|
|
|
"*Symbol face used to visualize 8 or more SPACEs at beginning of line.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color'."
|
2008-01-25 14:09:57 +00:00
|
|
|
|
:type 'face
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defface whitespace-indentation
|
2008-01-25 14:09:57 +00:00
|
|
|
|
'((((class mono)) (:inverse-video t :bold t :underline t))
|
|
|
|
|
(t (:background "yellow" :foreground "firebrick")))
|
|
|
|
|
"Face used to visualize 8 or more SPACEs at beginning of line."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-empty 'whitespace-empty
|
2008-01-25 14:09:57 +00:00
|
|
|
|
"*Symbol face used to visualize empty lines at beginning and/or end of buffer.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color'."
|
2008-01-25 14:09:57 +00:00
|
|
|
|
:type 'face
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defface whitespace-empty
|
2008-01-25 14:09:57 +00:00
|
|
|
|
'((((class mono)) (:inverse-video t :bold t :underline t))
|
|
|
|
|
(t (:background "yellow" :foreground "firebrick")))
|
|
|
|
|
"Face used to visualize empty lines at beginning and/or end of buffer."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-space-after-tab 'whitespace-space-after-tab
|
2008-01-25 14:09:57 +00:00
|
|
|
|
"*Symbol face used to visualize 8 or more SPACEs after TAB.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color'."
|
2008-01-25 14:09:57 +00:00
|
|
|
|
:type 'face
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defface whitespace-space-after-tab
|
2008-01-25 14:09:57 +00:00
|
|
|
|
'((((class mono)) (:inverse-video t :bold t :underline t))
|
|
|
|
|
(t (:background "yellow" :foreground "firebrick")))
|
|
|
|
|
"Face used to visualize 8 or more SPACEs after TAB."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-hspace-regexp
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"\\(\\(\xA0\\|\x8A0\\|\x920\\|\xE20\\|\xF20\\)+\\)"
|
|
|
|
|
"*Specify HARD SPACE characters regexp.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If you're using `mule' package, there may be other characters besides:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
\"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \"\\xF20\"
|
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
that should be considered HARD SPACE.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
Here are some examples:
|
|
|
|
|
|
|
|
|
|
\"\\\\(^\\xA0+\\\\)\" \
|
2008-01-21 12:45:58 +00:00
|
|
|
|
visualize only leading HARD SPACEs.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
\"\\\\(\\xA0+$\\\\)\" \
|
2008-01-21 12:45:58 +00:00
|
|
|
|
visualize only trailing HARD SPACEs.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
\"\\\\(^\\xA0+\\\\|\\xA0+$\\\\)\" \
|
2008-01-21 12:45:58 +00:00
|
|
|
|
visualize leading and/or trailing HARD SPACEs.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
\"\\t\\\\(\\xA0+\\\\)\\t\" \
|
2008-01-21 12:45:58 +00:00
|
|
|
|
visualize only HARD SPACEs between TABs.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
NOTE: Enclose always by \\\\( and \\\\) the elements to highlight.
|
|
|
|
|
Use exactly one pair of enclosing \\\\( and \\\\).
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color',
|
|
|
|
|
and `whitespace-chars' includes `spaces'."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type '(regexp :tag "HARD SPACE Chars")
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-space-regexp "\\( +\\)"
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"*Specify SPACE characters regexp.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If you're using `mule' package, there may be other characters
|
2008-01-21 12:45:58 +00:00
|
|
|
|
besides \" \" that should be considered SPACE.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
Here are some examples:
|
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
\"\\\\(^ +\\\\)\" visualize only leading SPACEs.
|
|
|
|
|
\"\\\\( +$\\\\)\" visualize only trailing SPACEs.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
\"\\\\(^ +\\\\| +$\\\\)\" \
|
2008-01-21 12:45:58 +00:00
|
|
|
|
visualize leading and/or trailing SPACEs.
|
|
|
|
|
\"\\t\\\\( +\\\\)\\t\" visualize only SPACEs between TABs.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
NOTE: Enclose always by \\\\( and \\\\) the elements to highlight.
|
|
|
|
|
Use exactly one pair of enclosing \\\\( and \\\\).
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color',
|
|
|
|
|
and `whitespace-chars' includes `spaces'."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type '(regexp :tag "SPACE Chars")
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-tab-regexp "\\(\t+\\)"
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"*Specify TAB characters regexp.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If you're using `mule' package, there may be other characters
|
2008-01-21 12:45:58 +00:00
|
|
|
|
besides \"\\t\" that should be considered TAB.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
Here are some examples:
|
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
\"\\\\(^\\t+\\\\)\" visualize only leading TABs.
|
|
|
|
|
\"\\\\(\\t+$\\\\)\" visualize only trailing TABs.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
\"\\\\(^\\t+\\\\|\\t+$\\\\)\" \
|
2008-01-21 12:45:58 +00:00
|
|
|
|
visualize leading and/or trailing TABs.
|
|
|
|
|
\" \\\\(\\t+\\\\) \" visualize only TABs between SPACEs.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
NOTE: Enclose always by \\\\( and \\\\) the elements to highlight.
|
|
|
|
|
Use exactly one pair of enclosing \\\\( and \\\\).
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color',
|
|
|
|
|
and `whitespace-chars' includes `tabs'."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type '(regexp :tag "TAB Chars")
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-trailing-regexp
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"\t\\| \\|\xA0\\|\x8A0\\|\x920\\|\xE20\\|\xF20"
|
|
|
|
|
"*Specify trailing characters regexp.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If you're using `mule' package, there may be other characters besides:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
\" \" \"\\t\" \"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \
|
|
|
|
|
\"\\xF20\"
|
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
that should be considered blank.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
NOTE: DO NOT enclose by \\\\( and \\\\) the elements to highlight.
|
2008-01-31 16:08:29 +00:00
|
|
|
|
`whitespace-mode' surrounds this regexp by \"\\\\(\\\\(\" and
|
2008-01-17 12:46:55 +00:00
|
|
|
|
\"\\\\)+\\\\)$\".
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color',
|
|
|
|
|
and `whitespace-chars' includes `trailing'."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type '(regexp :tag "Trailing Chars")
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-space-before-tab-regexp "\\( +\\)\t"
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"*Specify SPACEs before TAB regexp.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If you're using `mule' package, there may be other characters besides:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
\" \" \"\\t\" \"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \
|
|
|
|
|
\"\\xF20\"
|
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
that should be considered blank.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color',
|
|
|
|
|
and `whitespace-chars' includes `space-before-tab'."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type '(regexp :tag "SPACEs Before TAB")
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-indentation-regexp
|
|
|
|
|
"^\t*\\(\\( \\{8\\}\\)+\\)[^\n\t]"
|
2008-01-25 14:09:57 +00:00
|
|
|
|
"*Specify regexp for 8 or more SPACEs at beginning of line.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If you're using `mule' package, there may be other characters besides:
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
\" \" \"\\t\" \"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \
|
|
|
|
|
\"\\xF20\"
|
|
|
|
|
|
|
|
|
|
that should be considered blank.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color',
|
|
|
|
|
and `whitespace-chars' includes `indentation'."
|
2008-01-25 14:09:57 +00:00
|
|
|
|
:type '(regexp :tag "Indentation SPACEs")
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-empty-at-bob-regexp "\\`\\(\\([ \t]*\n\\)+\\)"
|
2008-01-25 14:09:57 +00:00
|
|
|
|
"*Specify regexp for empty lines at beginning of buffer.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If you're using `mule' package, there may be other characters besides:
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
\" \" \"\\t\" \"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \
|
|
|
|
|
\"\\xF20\"
|
|
|
|
|
|
|
|
|
|
that should be considered blank.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color',
|
|
|
|
|
and `whitespace-chars' includes `empty'."
|
2008-01-25 14:09:57 +00:00
|
|
|
|
:type '(regexp :tag "Empty Lines At Beginning Of Buffer")
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]+\\)\\'"
|
2008-01-25 14:09:57 +00:00
|
|
|
|
"*Specify regexp for empty lines at end of buffer.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If you're using `mule' package, there may be other characters besides:
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
\" \" \"\\t\" \"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \
|
|
|
|
|
\"\\xF20\"
|
|
|
|
|
|
|
|
|
|
that should be considered blank.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color',
|
|
|
|
|
and `whitespace-chars' includes `empty'."
|
2008-01-25 14:09:57 +00:00
|
|
|
|
:type '(regexp :tag "Empty Lines At End Of Buffer")
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-space-after-tab-regexp "\t\\(\\( \\{8\\}\\)+\\)"
|
2008-01-25 14:09:57 +00:00
|
|
|
|
"*Specify regexp for 8 or more SPACEs after TAB.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If you're using `mule' package, there may be other characters besides:
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
\" \" \"\\t\" \"\\xA0\" \"\\x8A0\" \"\\x920\" \"\\xE20\" \
|
|
|
|
|
\"\\xF20\"
|
|
|
|
|
|
|
|
|
|
that should be considered blank.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color',
|
|
|
|
|
and `whitespace-chars' includes `space-after-tab'."
|
2008-01-25 14:09:57 +00:00
|
|
|
|
:type '(regexp :tag "SPACEs After TAB")
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-line-column 80
|
2008-01-26 01:47:21 +00:00
|
|
|
|
"*Specify column beyond which the line is highlighted.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `color',
|
|
|
|
|
and `whitespace-chars' includes `lines' or `lines-tail'."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type '(integer :tag "Line Length")
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Hacked from `visible-whitespace-mappings' in visws.el
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-display-mappings
|
2008-01-17 12:46:55 +00:00
|
|
|
|
'(
|
|
|
|
|
(?\ [?\xB7] [?.]) ; space - centered dot
|
|
|
|
|
(?\xA0 [?\xA4] [?_]) ; hard space - currency
|
|
|
|
|
(?\x8A0 [?\x8A4] [?_]) ; hard space - currency
|
|
|
|
|
(?\x920 [?\x924] [?_]) ; hard space - currency
|
|
|
|
|
(?\xE20 [?\xE24] [?_]) ; hard space - currency
|
|
|
|
|
(?\xF20 [?\xF24] [?_]) ; hard space - currency
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; NEWLINE is displayed using the face `whitespace-newline'
|
2008-03-01 19:00:24 +00:00
|
|
|
|
(?\n [?\u21B5 ?\n] [?$ ?\n]) ; end-of-line - downwards arrow
|
|
|
|
|
;; (?\n [?$ ?\n]) ; end-of-line - dollar sign
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; (?\n [?\xB6 ?\n] [?$ ?\n]) ; end-of-line - pilcrow
|
|
|
|
|
;; (?\n [?\x8AF ?\n] [?$ ?\n]) ; end-of-line - overscore
|
|
|
|
|
;; (?\n [?\x8AC ?\n] [?$ ?\n]) ; end-of-line - negation
|
|
|
|
|
;; (?\n [?\x8B0 ?\n] [?$ ?\n]) ; end-of-line - grade
|
|
|
|
|
;;
|
|
|
|
|
;; WARNING: the mapping below has a problem.
|
|
|
|
|
;; When a TAB occupies exactly one column, it will display the
|
|
|
|
|
;; character ?\xBB at that column followed by a TAB which goes to
|
|
|
|
|
;; the next TAB column.
|
|
|
|
|
;; If this is a problem for you, please, comment the line below.
|
|
|
|
|
(?\t [?\xBB ?\t] [?\\ ?\t]) ; tab - left quote mark
|
|
|
|
|
)
|
|
|
|
|
"*Specify an alist of mappings for displaying characters.
|
|
|
|
|
|
|
|
|
|
Each element has the following form:
|
|
|
|
|
|
|
|
|
|
(CHAR VECTOR...)
|
|
|
|
|
|
|
|
|
|
Where:
|
|
|
|
|
|
|
|
|
|
CHAR is the character to be mapped.
|
|
|
|
|
|
|
|
|
|
VECTOR is a vector of characters to be displayed in place of CHAR.
|
|
|
|
|
The first display vector that can be displayed is used;
|
|
|
|
|
if no display vector for a mapping can be displayed, then
|
|
|
|
|
that character is displayed unmodified.
|
|
|
|
|
|
|
|
|
|
The NEWLINE character is displayed using the face given by
|
2008-01-31 16:08:29 +00:00
|
|
|
|
`whitespace-newline' variable. The characters in the vector to
|
|
|
|
|
be displayed will not have this face applied if the character
|
|
|
|
|
code is above #x1FFFF.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Used when `whitespace-style' includes the value `mark'."
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:type '(repeat
|
|
|
|
|
(list :tag "Character Mapping"
|
|
|
|
|
(character :tag "Char")
|
|
|
|
|
(repeat :inline t :tag "Vector List"
|
|
|
|
|
(vector :tag ""
|
|
|
|
|
(repeat :inline t
|
|
|
|
|
:tag "Vector Characters"
|
|
|
|
|
(character :tag "Char"))))))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defcustom whitespace-global-modes t
|
|
|
|
|
"*Modes for which global `whitespace-mode' is automagically turned on.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
Global `whitespace-mode' is controlled by the command
|
|
|
|
|
`global-whitespace-mode'.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
If nil, means no modes have `whitespace-mode' automatically
|
2008-01-17 12:46:55 +00:00
|
|
|
|
turned on.
|
2008-01-31 16:08:29 +00:00
|
|
|
|
|
|
|
|
|
If t, all modes that support `whitespace-mode' have it
|
|
|
|
|
automatically turned on.
|
|
|
|
|
|
|
|
|
|
Else it should be a list of `major-mode' symbol names for which
|
|
|
|
|
`whitespace-mode' should be automatically turned on. The sense
|
2008-01-17 12:46:55 +00:00
|
|
|
|
of the list is negated if it begins with `not'. For example:
|
|
|
|
|
|
|
|
|
|
(c-mode c++-mode)
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
means that `whitespace-mode' is turned on for buffers in C and
|
|
|
|
|
C++ modes only."
|
2008-03-01 19:00:24 +00:00
|
|
|
|
:type '(choice :tag "Global Modes"
|
|
|
|
|
(const :tag "None" nil)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
(const :tag "All" t)
|
|
|
|
|
(set :menu-tag "Mode Specific" :tag "Modes"
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:value (not)
|
|
|
|
|
(const :tag "Except" not)
|
|
|
|
|
(repeat :inline t
|
2008-01-25 14:09:57 +00:00
|
|
|
|
(symbol :tag "Mode"))))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-03-01 19:00:24 +00:00
|
|
|
|
|
|
|
|
|
(defcustom whitespace-action nil
|
|
|
|
|
"*Specify which action is taken when a buffer is visited, killed or written.
|
|
|
|
|
|
|
|
|
|
It's a list containing some or all of the following values:
|
|
|
|
|
|
|
|
|
|
nil no action is taken.
|
|
|
|
|
|
|
|
|
|
cleanup cleanup any bogus whitespace always when local
|
|
|
|
|
whitespace is turned on.
|
|
|
|
|
See `whitespace-cleanup' and
|
|
|
|
|
`whitespace-cleanup-region'.
|
|
|
|
|
|
|
|
|
|
report-on-bogus report if there is any bogus whitespace always
|
|
|
|
|
when local whitespace is turned on.
|
|
|
|
|
|
|
|
|
|
auto-cleanup cleanup any bogus whitespace when buffer is
|
|
|
|
|
written or killed.
|
|
|
|
|
See `whitespace-cleanup' and
|
|
|
|
|
`whitespace-cleanup-region'.
|
|
|
|
|
|
|
|
|
|
abort-on-bogus abort if there is any bogus whitespace and the
|
|
|
|
|
buffer is written or killed.
|
|
|
|
|
|
|
|
|
|
Any other value is treated as nil."
|
|
|
|
|
:type '(choice :tag "Actions"
|
|
|
|
|
(const :tag "None" nil)
|
|
|
|
|
(repeat :tag "Action List"
|
|
|
|
|
(choice :tag "Action"
|
|
|
|
|
(const :tag "Cleanup When On" cleanup)
|
|
|
|
|
(const :tag "Report On Bogus" report-on-bogus)
|
|
|
|
|
(const :tag "Auto Cleanup" auto-cleanup)
|
|
|
|
|
(const :tag "Abort On Bogus" abort-on-bogus))))
|
|
|
|
|
:group 'whitespace)
|
|
|
|
|
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;;; User commands - Local mode
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(define-minor-mode whitespace-mode
|
|
|
|
|
"Toggle whitespace minor mode visualization (\"ws\" on modeline).
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
If ARG is null, toggle whitespace visualization.
|
2008-01-21 12:45:58 +00:00
|
|
|
|
If ARG is a number greater than zero, turn on visualization;
|
|
|
|
|
otherwise, turn off visualization.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
Only useful with a windowing system."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:lighter " ws"
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:init-value nil
|
|
|
|
|
:global nil
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(cond
|
|
|
|
|
(noninteractive ; running a batch job
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(setq whitespace-mode nil))
|
|
|
|
|
(whitespace-mode ; whitespace-mode on
|
2008-03-01 19:00:24 +00:00
|
|
|
|
(whitespace-turn-on)
|
|
|
|
|
(whitespace-action-when-on))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(t ; whitespace-mode off
|
|
|
|
|
(whitespace-turn-off))))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;;; User commands - Global mode
|
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(define-minor-mode global-whitespace-mode
|
|
|
|
|
"Toggle whitespace global minor mode visualization (\"WS\" on modeline).
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
If ARG is null, toggle whitespace visualization.
|
2008-01-21 12:45:58 +00:00
|
|
|
|
If ARG is a number greater than zero, turn on visualization;
|
|
|
|
|
otherwise, turn off visualization.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
Only useful with a windowing system."
|
2008-02-01 10:25:35 +00:00
|
|
|
|
:lighter " WS"
|
2008-01-17 12:46:55 +00:00
|
|
|
|
:init-value nil
|
|
|
|
|
:global t
|
2008-01-31 16:08:29 +00:00
|
|
|
|
:group 'whitespace
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(cond
|
|
|
|
|
(noninteractive ; running a batch job
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(setq global-whitespace-mode nil))
|
|
|
|
|
(global-whitespace-mode ; global-whitespace-mode on
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(save-excursion
|
2008-03-01 19:00:24 +00:00
|
|
|
|
(add-hook 'find-file-hook 'whitespace-turn-on-if-enabled)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(dolist (buffer (buffer-list)) ; adjust all local mode
|
|
|
|
|
(set-buffer buffer)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(unless whitespace-mode
|
|
|
|
|
(whitespace-turn-on-if-enabled)))))
|
|
|
|
|
(t ; global-whitespace-mode off
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(save-excursion
|
2008-02-01 18:52:51 +00:00
|
|
|
|
(remove-hook 'find-file-hook 'whitespace-turn-on-if-enabled)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(dolist (buffer (buffer-list)) ; adjust all local mode
|
|
|
|
|
(set-buffer buffer)
|
2008-02-02 17:41:55 +00:00
|
|
|
|
(unless whitespace-mode
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(whitespace-turn-off)))))))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-turn-on-if-enabled ()
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(when (cond
|
2008-01-31 16:08:29 +00:00
|
|
|
|
((eq whitespace-global-modes t))
|
|
|
|
|
((listp whitespace-global-modes)
|
|
|
|
|
(if (eq (car-safe whitespace-global-modes) 'not)
|
|
|
|
|
(not (memq major-mode (cdr whitespace-global-modes)))
|
|
|
|
|
(memq major-mode whitespace-global-modes)))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(t nil))
|
|
|
|
|
(let (inhibit-quit)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; Don't turn on whitespace mode if...
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(or
|
|
|
|
|
;; ...we don't have a display (we're running a batch job)
|
|
|
|
|
noninteractive
|
|
|
|
|
;; ...or if the buffer is invisible (name starts with a space)
|
|
|
|
|
(eq (aref (buffer-name) 0) ?\ )
|
|
|
|
|
;; ...or if the buffer is temporary (name starts with *)
|
|
|
|
|
(and (eq (aref (buffer-name) 0) ?*)
|
|
|
|
|
;; except the scratch buffer.
|
|
|
|
|
(not (string= (buffer-name) "*scratch*")))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; Otherwise, turn on whitespace mode.
|
|
|
|
|
(whitespace-turn-on)))))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;;; User commands - Toggle
|
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defconst whitespace-chars-value-list
|
2008-01-17 12:46:55 +00:00
|
|
|
|
'(tabs
|
|
|
|
|
spaces
|
|
|
|
|
trailing
|
|
|
|
|
space-before-tab
|
|
|
|
|
lines
|
2008-01-26 01:47:21 +00:00
|
|
|
|
lines-tail
|
2008-01-17 12:46:55 +00:00
|
|
|
|
newline
|
2008-01-25 14:09:57 +00:00
|
|
|
|
indentation
|
|
|
|
|
empty
|
|
|
|
|
space-after-tab
|
2008-01-17 12:46:55 +00:00
|
|
|
|
)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
"List of valid `whitespace-chars' values.")
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defconst whitespace-style-value-list
|
2008-01-17 12:46:55 +00:00
|
|
|
|
'(color
|
|
|
|
|
mark
|
|
|
|
|
)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
"List of valid `whitespace-style' values.")
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defconst whitespace-toggle-option-alist
|
2008-01-17 12:46:55 +00:00
|
|
|
|
'((?t . tabs)
|
|
|
|
|
(?s . spaces)
|
|
|
|
|
(?r . trailing)
|
|
|
|
|
(?b . space-before-tab)
|
|
|
|
|
(?l . lines)
|
2008-01-26 01:47:21 +00:00
|
|
|
|
(?L . lines-tail)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(?n . newline)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
(?i . indentation)
|
|
|
|
|
(?e . empty)
|
|
|
|
|
(?a . space-after-tab)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(?c . color)
|
|
|
|
|
(?m . mark)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(?x . whitespace-chars)
|
|
|
|
|
(?z . whitespace-style)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
)
|
|
|
|
|
"Alist of toggle options.
|
|
|
|
|
|
|
|
|
|
Each element has the form:
|
|
|
|
|
|
|
|
|
|
(CHAR . SYMBOL)
|
|
|
|
|
|
|
|
|
|
Where:
|
|
|
|
|
|
|
|
|
|
CHAR is a char which the user will have to type.
|
|
|
|
|
|
|
|
|
|
SYMBOL is a valid symbol associated with CHAR.
|
2008-01-31 16:08:29 +00:00
|
|
|
|
See `whitespace-chars-value-list' and
|
|
|
|
|
`whitespace-style-value-list'.")
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defvar whitespace-active-chars nil
|
|
|
|
|
"Used to save locally `whitespace-chars' value.")
|
|
|
|
|
(make-variable-buffer-local 'whitespace-active-chars)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defvar whitespace-active-style nil
|
|
|
|
|
"Used to save locally `whitespace-style' value.")
|
|
|
|
|
(make-variable-buffer-local 'whitespace-active-style)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-toggle-options (arg)
|
|
|
|
|
"Toggle local `whitespace-mode' options.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
If local whitespace-mode is off, toggle the option given by ARG
|
|
|
|
|
and turn on local whitespace-mode.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
If local whitespace-mode is on, toggle the option given by ARG
|
|
|
|
|
and restart local whitespace-mode.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
Interactively, it reads one of the following chars:
|
|
|
|
|
|
|
|
|
|
CHAR MEANING
|
2008-01-21 12:45:58 +00:00
|
|
|
|
t toggle TAB visualization
|
|
|
|
|
s toggle SPACE and HARD SPACE visualization
|
|
|
|
|
r toggle trailing blanks visualization
|
|
|
|
|
b toggle SPACEs before TAB visualization
|
|
|
|
|
l toggle \"long lines\" visualization
|
2008-01-26 01:47:21 +00:00
|
|
|
|
L toggle \"long lines\" tail visualization
|
2008-01-21 12:45:58 +00:00
|
|
|
|
n toggle NEWLINE visualization
|
2008-01-25 14:09:57 +00:00
|
|
|
|
i toggle indentation SPACEs visualization
|
|
|
|
|
e toggle empty line at bob and/or eob visualization
|
|
|
|
|
a toggle SPACEs after TAB visualization
|
2008-01-17 12:46:55 +00:00
|
|
|
|
c toggle color faces
|
|
|
|
|
m toggle visual mark
|
2008-01-31 16:08:29 +00:00
|
|
|
|
x restore `whitespace-chars' value
|
|
|
|
|
z restore `whitespace-style' value
|
2008-01-17 12:46:55 +00:00
|
|
|
|
? display brief help
|
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
Non-interactively, ARG should be a symbol or a list of symbols.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
The valid symbols are:
|
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
tabs toggle TAB visualization
|
|
|
|
|
spaces toggle SPACE and HARD SPACE visualization
|
|
|
|
|
trailing toggle trailing blanks visualization
|
|
|
|
|
space-before-tab toggle SPACEs before TAB visualization
|
|
|
|
|
lines toggle \"long lines\" visualization
|
2008-01-26 01:47:21 +00:00
|
|
|
|
lines-tail toggle \"long lines\" tail visualization
|
2008-01-21 12:45:58 +00:00
|
|
|
|
newline toggle NEWLINE visualization
|
2008-01-25 14:09:57 +00:00
|
|
|
|
indentation toggle indentation SPACEs visualization
|
|
|
|
|
empty toggle empty line at bob and/or eob visualization
|
|
|
|
|
space-after-tab toggle SPACEs after TAB visualization
|
2008-01-17 12:46:55 +00:00
|
|
|
|
color toggle color faces
|
|
|
|
|
mark toggle visual mark
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
whitespace-chars restore `whitespace-chars' value
|
|
|
|
|
whitespace-style restore `whitespace-style' value
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
Only useful with a windowing system."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(interactive (whitespace-interactive-char t))
|
|
|
|
|
(let ((whitespace-chars
|
|
|
|
|
(whitespace-toggle-list
|
|
|
|
|
t arg whitespace-active-chars whitespace-chars
|
|
|
|
|
'whitespace-chars whitespace-chars-value-list))
|
|
|
|
|
(whitespace-style
|
|
|
|
|
(whitespace-toggle-list
|
|
|
|
|
t arg whitespace-active-style whitespace-style
|
|
|
|
|
'whitespace-style whitespace-style-value-list)))
|
|
|
|
|
(whitespace-mode 0)
|
|
|
|
|
(whitespace-mode 1)))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defvar whitespace-toggle-chars nil
|
|
|
|
|
"Used to toggle the global `whitespace-chars' value.")
|
|
|
|
|
(defvar whitespace-toggle-style nil
|
|
|
|
|
"Used to toggle the global `whitespace-style' value.")
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun global-whitespace-toggle-options (arg)
|
|
|
|
|
"Toggle global `whitespace-mode' options.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
If global whitespace-mode is off, toggle the option given by ARG
|
|
|
|
|
and turn on global whitespace-mode.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
If global whitespace-mode is on, toggle the option given by ARG
|
|
|
|
|
and restart global whitespace-mode.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
Interactively, it accepts one of the following chars:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
CHAR MEANING
|
2008-01-21 12:45:58 +00:00
|
|
|
|
t toggle TAB visualization
|
|
|
|
|
s toggle SPACE and HARD SPACE visualization
|
|
|
|
|
r toggle trailing blanks visualization
|
|
|
|
|
b toggle SPACEs before TAB visualization
|
|
|
|
|
l toggle \"long lines\" visualization
|
2008-01-26 01:47:21 +00:00
|
|
|
|
L toggle \"long lines\" tail visualization
|
2008-01-21 12:45:58 +00:00
|
|
|
|
n toggle NEWLINE visualization
|
2008-01-25 14:09:57 +00:00
|
|
|
|
i toggle indentation SPACEs visualization
|
|
|
|
|
e toggle empty line at bob and/or eob visualization
|
|
|
|
|
a toggle SPACEs after TAB visualization
|
2008-01-17 12:46:55 +00:00
|
|
|
|
c toggle color faces
|
|
|
|
|
m toggle visual mark
|
2008-01-31 16:08:29 +00:00
|
|
|
|
x restore `whitespace-chars' value
|
|
|
|
|
z restore `whitespace-style' value
|
2008-01-17 12:46:55 +00:00
|
|
|
|
? display brief help
|
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
Non-interactively, ARG should be a symbol or a list of symbols.
|
2008-01-17 12:46:55 +00:00
|
|
|
|
The valid symbols are:
|
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
tabs toggle TAB visualization
|
|
|
|
|
spaces toggle SPACE and HARD SPACE visualization
|
|
|
|
|
trailing toggle trailing blanks visualization
|
|
|
|
|
space-before-tab toggle SPACEs before TAB visualization
|
|
|
|
|
lines toggle \"long lines\" visualization
|
2008-01-26 01:47:21 +00:00
|
|
|
|
lines-tail toggle \"long lines\" tail visualization
|
2008-01-21 12:45:58 +00:00
|
|
|
|
newline toggle NEWLINE visualization
|
2008-01-25 14:09:57 +00:00
|
|
|
|
indentation toggle indentation SPACEs visualization
|
|
|
|
|
empty toggle empty line at bob and/or eob visualization
|
|
|
|
|
space-after-tab toggle SPACEs after TAB visualization
|
2008-01-17 12:46:55 +00:00
|
|
|
|
color toggle color faces
|
|
|
|
|
mark toggle visual mark
|
2008-02-01 18:52:51 +00:00
|
|
|
|
whitespace-chars restore `whitespace-chars' value
|
|
|
|
|
whitespace-style restore `whitespace-style' value
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
Only useful with a windowing system."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(interactive (whitespace-interactive-char nil))
|
|
|
|
|
(let ((whitespace-chars
|
|
|
|
|
(whitespace-toggle-list
|
|
|
|
|
nil arg whitespace-toggle-chars whitespace-chars
|
|
|
|
|
'whitespace-chars whitespace-chars-value-list))
|
|
|
|
|
(whitespace-style
|
|
|
|
|
(whitespace-toggle-list
|
|
|
|
|
nil arg whitespace-toggle-style whitespace-style
|
|
|
|
|
'whitespace-style whitespace-style-value-list)))
|
|
|
|
|
(setq whitespace-toggle-chars whitespace-chars
|
|
|
|
|
whitespace-toggle-style whitespace-style)
|
|
|
|
|
(global-whitespace-mode 0)
|
|
|
|
|
(global-whitespace-mode 1)))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;;; User commands - Cleanup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-cleanup ()
|
2008-01-25 14:09:57 +00:00
|
|
|
|
"Cleanup some blank problems in all buffer or at region.
|
|
|
|
|
|
|
|
|
|
It usually applies to the whole buffer, but in transient mark
|
|
|
|
|
mode when the mark is active, it applies to the region. It also
|
|
|
|
|
applies to the region when it is not in transiente mark mode, the
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
mark is active and \\[universal-argument] was pressed just before calling
|
2008-01-31 16:08:29 +00:00
|
|
|
|
`whitespace-cleanup' interactively.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
See also `whitespace-cleanup-region'.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
The problems cleaned up are:
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
1. empty lines at beginning of buffer.
|
|
|
|
|
2. empty lines at end of buffer.
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If `whitespace-chars' includes the value `empty', remove all
|
2008-01-31 16:08:29 +00:00
|
|
|
|
empty lines at beginning and/or end of buffer.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
3. 8 or more SPACEs at beginning of line.
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If `whitespace-chars' includes the value `indentation', replace
|
2008-01-31 16:08:29 +00:00
|
|
|
|
8 or more SPACEs at beginning of line by TABs.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
4. SPACEs before TAB.
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If `whitespace-chars' includes the value `space-before-tab',
|
2008-01-31 16:08:29 +00:00
|
|
|
|
replace SPACEs by TABs.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
5. SPACEs or TABs at end of line.
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If `whitespace-chars' includes the value `trailing', remove all
|
2008-01-25 14:09:57 +00:00
|
|
|
|
SPACEs or TABs at end of line.
|
|
|
|
|
|
|
|
|
|
6. 8 or more SPACEs after TAB.
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If `whitespace-chars' includes the value `space-after-tab',
|
2008-01-31 16:08:29 +00:00
|
|
|
|
replace SPACEs by TABs."
|
2008-01-25 14:09:57 +00:00
|
|
|
|
(interactive "@*")
|
|
|
|
|
(if (and (or transient-mark-mode
|
|
|
|
|
current-prefix-arg)
|
|
|
|
|
mark-active)
|
|
|
|
|
;; region active
|
|
|
|
|
;; problems 1 and 2 are not handled in region
|
|
|
|
|
;; problem 3: 8 or more SPACEs at bol
|
|
|
|
|
;; problem 4: SPACEs before TAB
|
|
|
|
|
;; problem 5: SPACEs or TABs at eol
|
|
|
|
|
;; problem 6: 8 or more SPACEs after TAB
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(whitespace-cleanup-region (region-beginning) (region-end))
|
2008-01-25 14:09:57 +00:00
|
|
|
|
;; whole buffer
|
|
|
|
|
(save-excursion
|
2008-01-26 01:47:21 +00:00
|
|
|
|
(save-match-data
|
|
|
|
|
;; problem 1: empty lines at bob
|
|
|
|
|
;; problem 2: empty lines at eob
|
|
|
|
|
;; action: remove all empty lines at bob and/or eob
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (memq 'empty whitespace-chars)
|
2008-01-26 01:47:21 +00:00
|
|
|
|
(let (overwrite-mode) ; enforce no overwrite
|
|
|
|
|
(goto-char (point-min))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (re-search-forward
|
|
|
|
|
whitespace-empty-at-bob-regexp nil t)
|
2008-01-26 01:47:21 +00:00
|
|
|
|
(delete-region (match-beginning 1) (match-end 1)))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (re-search-forward
|
|
|
|
|
whitespace-empty-at-eob-regexp nil t)
|
2008-01-26 01:47:21 +00:00
|
|
|
|
(delete-region (match-beginning 1) (match-end 1)))))))
|
|
|
|
|
;; problem 3: 8 or more SPACEs at bol
|
|
|
|
|
;; problem 4: SPACEs before TAB
|
|
|
|
|
;; problem 5: SPACEs or TABs at eol
|
|
|
|
|
;; problem 6: 8 or more SPACEs after TAB
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(whitespace-cleanup-region (point-min) (point-max))))
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-cleanup-region (start end)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
"Cleanup some blank problems at region.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
The problems cleaned up are:
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
1. 8 or more SPACEs at beginning of line.
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If `whitespace-chars' includes the value `indentation', replace
|
2008-01-31 16:08:29 +00:00
|
|
|
|
8 or more SPACEs at beginning of line by TABs.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
2. SPACEs before TAB.
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If `whitespace-chars' includes the value `space-before-tab',
|
2008-01-31 16:08:29 +00:00
|
|
|
|
replace SPACEs by TABs.
|
2008-01-25 14:09:57 +00:00
|
|
|
|
|
|
|
|
|
3. SPACEs or TABs at end of line.
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If `whitespace-chars' includes the value `trailing', remove all
|
2008-01-25 14:09:57 +00:00
|
|
|
|
SPACEs or TABs at end of line.
|
|
|
|
|
|
|
|
|
|
4. 8 or more SPACEs after TAB.
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
If `whitespace-chars' includes the value `space-after-tab',
|
2008-01-31 16:08:29 +00:00
|
|
|
|
replace SPACEs by TABs."
|
2008-01-25 14:09:57 +00:00
|
|
|
|
(interactive "@*r")
|
|
|
|
|
(let ((rstart (min start end))
|
|
|
|
|
(rend (copy-marker (max start end)))
|
|
|
|
|
(tab-width 8) ; assure TAB width
|
|
|
|
|
(indent-tabs-mode t) ; always insert TABs
|
|
|
|
|
overwrite-mode ; enforce no overwrite
|
|
|
|
|
tmp)
|
|
|
|
|
(save-excursion
|
2008-01-26 01:47:21 +00:00
|
|
|
|
(save-match-data
|
|
|
|
|
;; problem 1: 8 or more SPACEs at bol
|
|
|
|
|
;; action: replace 8 or more SPACEs at bol by TABs
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (memq 'indentation whitespace-chars)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
(goto-char rstart)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(while (re-search-forward
|
|
|
|
|
whitespace-indentation-regexp rend t)
|
2008-01-26 01:47:21 +00:00
|
|
|
|
(setq tmp (current-indentation))
|
2008-03-01 19:00:24 +00:00
|
|
|
|
(goto-char (match-beginning 0))
|
2008-01-26 01:47:21 +00:00
|
|
|
|
(delete-horizontal-space)
|
|
|
|
|
(unless (eolp)
|
|
|
|
|
(indent-to tmp))))
|
|
|
|
|
;; problem 3: SPACEs or TABs at eol
|
|
|
|
|
;; action: remove all SPACEs or TABs at eol
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (memq 'trailing whitespace-chars)
|
2008-03-01 19:00:24 +00:00
|
|
|
|
(let ((regexp (whitespace-trailing-regexp)))
|
2008-01-26 01:47:21 +00:00
|
|
|
|
(goto-char rstart)
|
|
|
|
|
(while (re-search-forward regexp rend t)
|
|
|
|
|
(delete-region (match-beginning 1) (match-end 1)))))
|
|
|
|
|
;; problem 4: 8 or more SPACEs after TAB
|
|
|
|
|
;; action: replace 8 or more SPACEs by TABs
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (memq 'space-after-tab whitespace-chars)
|
|
|
|
|
(whitespace-replace-spaces-by-tabs
|
|
|
|
|
rstart rend whitespace-space-after-tab-regexp))
|
2008-01-26 01:47:21 +00:00
|
|
|
|
;; problem 2: SPACEs before TAB
|
|
|
|
|
;; action: replace SPACEs before TAB by TABs
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (memq 'space-before-tab whitespace-chars)
|
|
|
|
|
(whitespace-replace-spaces-by-tabs
|
|
|
|
|
rstart rend whitespace-space-before-tab-regexp))))
|
2008-01-25 14:09:57 +00:00
|
|
|
|
(set-marker rend nil))) ; point marker to nowhere
|
|
|
|
|
|
2008-01-26 01:47:21 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-replace-spaces-by-tabs (rstart rend regexp)
|
2008-01-26 01:47:21 +00:00
|
|
|
|
"Replace all SPACEs by TABs matched by REGEXP between RSTART and REND."
|
|
|
|
|
(goto-char rstart)
|
|
|
|
|
(while (re-search-forward regexp rend t)
|
|
|
|
|
(goto-char (match-beginning 1))
|
|
|
|
|
(let* ((scol (current-column))
|
|
|
|
|
(ecol (save-excursion
|
|
|
|
|
(goto-char (match-end 1))
|
|
|
|
|
(current-column))))
|
|
|
|
|
(delete-region (match-beginning 1) (match-end 1))
|
|
|
|
|
(insert-char ?\t
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(/ (- (- ecol (% ecol 8)) ; prev end col
|
|
|
|
|
(- scol (% scol 8))) ; prev start col
|
2008-01-26 01:47:21 +00:00
|
|
|
|
8)))))
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2008-03-01 19:00:24 +00:00
|
|
|
|
;;;; User command - report
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun whitespace-trailing-regexp ()
|
|
|
|
|
"Make the `whitespace-trailing-regexp' regexp."
|
|
|
|
|
(concat "\\(\\(" whitespace-trailing-regexp "\\)+\\)$"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defconst whitespace-report-list
|
|
|
|
|
(list
|
|
|
|
|
(cons 'empty whitespace-empty-at-bob-regexp)
|
|
|
|
|
(cons 'empty whitespace-empty-at-eob-regexp)
|
|
|
|
|
(cons 'indentation whitespace-indentation-regexp)
|
|
|
|
|
(cons 'space-before-tab whitespace-space-before-tab-regexp)
|
|
|
|
|
(cons 'trailing (whitespace-trailing-regexp))
|
|
|
|
|
(cons 'space-after-tab whitespace-space-after-tab-regexp)
|
|
|
|
|
)
|
|
|
|
|
"List of whitespace bogus symbol and corresponding regexp.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defconst whitespace-report-text
|
|
|
|
|
"\
|
|
|
|
|
Whitespace Report
|
|
|
|
|
|
|
|
|
|
Current Setting Whitespace Problem
|
|
|
|
|
|
|
|
|
|
empty [] [] empty lines at beginning of buffer.
|
|
|
|
|
empty [] [] empty lines at end of buffer.
|
|
|
|
|
indentation [] [] 8 or more SPACEs at beginning of line.
|
|
|
|
|
space-before-tab [] [] SPACEs before TAB.
|
|
|
|
|
trailing [] [] SPACEs or TABs at end of line.
|
|
|
|
|
space-after-tab [] [] 8 or more SPACEs after TAB.\n\n"
|
|
|
|
|
"Text for whitespace bogus report.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defconst whitespace-report-buffer-name "*Whitespace Report*"
|
|
|
|
|
"The buffer name for whitespace bogus report.")
|
2008-01-31 16:08:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2008-03-01 19:00:24 +00:00
|
|
|
|
(defun whitespace-report (&optional force report-if-bogus)
|
|
|
|
|
"Report some whitespace problems in buffer.
|
2008-01-31 16:08:29 +00:00
|
|
|
|
|
2008-03-01 19:00:24 +00:00
|
|
|
|
Return nil if there is no whitespace problem; otherwise, return
|
|
|
|
|
non-nil.
|
2008-01-31 16:08:29 +00:00
|
|
|
|
|
2008-03-01 19:00:24 +00:00
|
|
|
|
If FORCE is non-nil or \\[universal-argument] was pressed just before calling
|
|
|
|
|
`whitespace-report' interactively, it forces `whitespace-chars' to
|
|
|
|
|
have:
|
2008-01-31 16:08:29 +00:00
|
|
|
|
|
2008-03-01 19:00:24 +00:00
|
|
|
|
empty
|
2008-01-31 16:08:29 +00:00
|
|
|
|
indentation
|
|
|
|
|
space-before-tab
|
2008-03-01 19:00:24 +00:00
|
|
|
|
trailing
|
|
|
|
|
space-after-tab
|
|
|
|
|
|
|
|
|
|
If REPORT-IF-BOGUS is non-nil, it reports only when there are any
|
|
|
|
|
whitespace problems in buffer.
|
|
|
|
|
|
|
|
|
|
Report if some of the following whitespace problems exist:
|
|
|
|
|
|
|
|
|
|
empty 1. empty lines at beginning of buffer.
|
|
|
|
|
empty 2. empty lines at end of buffer.
|
|
|
|
|
indentation 3. 8 or more SPACEs at beginning of line.
|
|
|
|
|
space-before-tab 4. SPACEs before TAB.
|
|
|
|
|
trailing 5. SPACEs or TABs at end of line.
|
|
|
|
|
space-after-tab 6. 8 or more SPACEs after TAB.
|
|
|
|
|
|
|
|
|
|
See `whitespace-chars' and `whitespace-style' for documentation.
|
|
|
|
|
See also `whitespace-cleanup' and `whitespace-cleanup-region' for
|
|
|
|
|
cleaning up these problems."
|
|
|
|
|
(interactive (list current-prefix-arg))
|
|
|
|
|
(whitespace-report-region (point-min) (point-max)
|
|
|
|
|
force report-if-bogus))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun whitespace-report-region (start end &optional force report-if-bogus)
|
|
|
|
|
"Report some whitespace problems in a region.
|
|
|
|
|
|
|
|
|
|
Return nil if there is no whitespace problem; otherwise, return
|
|
|
|
|
non-nil.
|
|
|
|
|
|
|
|
|
|
If FORCE is non-nil or \\[universal-argument] was pressed just before calling
|
|
|
|
|
`whitespace-report-region' interactively, it forces `whitespace-chars'
|
|
|
|
|
to have:
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
empty
|
2008-03-01 19:00:24 +00:00
|
|
|
|
indentation
|
|
|
|
|
space-before-tab
|
|
|
|
|
trailing
|
2008-01-31 16:08:29 +00:00
|
|
|
|
space-after-tab
|
|
|
|
|
|
2008-03-01 19:00:24 +00:00
|
|
|
|
If REPORT-IF-BOGUS is non-nil, it reports only when there are any
|
|
|
|
|
whitespace problems in buffer.
|
|
|
|
|
|
|
|
|
|
Report if some of the following whitespace problems exist:
|
2008-01-31 16:08:29 +00:00
|
|
|
|
|
|
|
|
|
empty 1. empty lines at beginning of buffer.
|
|
|
|
|
empty 2. empty lines at end of buffer.
|
|
|
|
|
indentation 3. 8 or more SPACEs at beginning of line.
|
|
|
|
|
space-before-tab 4. SPACEs before TAB.
|
|
|
|
|
trailing 5. SPACEs or TABs at end of line.
|
|
|
|
|
space-after-tab 6. 8 or more SPACEs after TAB.
|
|
|
|
|
|
|
|
|
|
See `whitespace-chars' and `whitespace-style' for documentation.
|
|
|
|
|
See also `whitespace-cleanup' and `whitespace-cleanup-region' for
|
|
|
|
|
cleaning up these problems."
|
2008-03-01 19:00:24 +00:00
|
|
|
|
(interactive "r")
|
|
|
|
|
(setq force (or current-prefix-arg force))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-match-data
|
|
|
|
|
(let* (has-bogus
|
|
|
|
|
(rstart (min start end))
|
|
|
|
|
(rend (max start end))
|
|
|
|
|
(bogus-list (mapcar
|
|
|
|
|
#'(lambda (option)
|
|
|
|
|
(when force
|
|
|
|
|
(add-to-list 'whitespace-chars (car option)))
|
|
|
|
|
(goto-char rstart)
|
|
|
|
|
(and (re-search-forward (cdr option) rend t)
|
|
|
|
|
(setq has-bogus t)))
|
|
|
|
|
whitespace-report-list)))
|
|
|
|
|
(when (if report-if-bogus has-bogus t)
|
|
|
|
|
(with-current-buffer (get-buffer-create
|
|
|
|
|
whitespace-report-buffer-name)
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert whitespace-report-text)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(forward-line 3)
|
|
|
|
|
(dolist (option whitespace-report-list)
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(whitespace-mark-x 22 (memq (car option) whitespace-chars))
|
|
|
|
|
(whitespace-mark-x 7 (car bogus-list))
|
|
|
|
|
(setq bogus-list (cdr bogus-list)))
|
|
|
|
|
(when has-bogus
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(insert " Type `M-x whitespace-cleanup'"
|
|
|
|
|
" to cleanup the buffer.\n\n")
|
|
|
|
|
(insert " Type `M-x whitespace-cleanup-region'"
|
|
|
|
|
" to cleanup a region.\n\n"))
|
|
|
|
|
(whitespace-display-window (current-buffer))))
|
|
|
|
|
has-bogus))))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;;; Internal functions
|
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defvar whitespace-font-lock-mode nil
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"Used to remember whether a buffer had font lock mode on or not.")
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(make-variable-buffer-local 'whitespace-font-lock-mode)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defvar whitespace-font-lock nil
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"Used to remember whether a buffer initially had font lock on or not.")
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(make-variable-buffer-local 'whitespace-font-lock)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defvar whitespace-font-lock-keywords nil
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"Used to save locally `font-lock-keywords' value.")
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(make-variable-buffer-local 'whitespace-font-lock-keywords)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defconst whitespace-help-text
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"\
|
2008-01-31 16:08:29 +00:00
|
|
|
|
whitespace-mode toggle options:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-21 12:45:58 +00:00
|
|
|
|
[] t - toggle TAB visualization
|
|
|
|
|
[] s - toggle SPACE and HARD SPACE visualization
|
|
|
|
|
[] r - toggle trailing blanks visualization
|
|
|
|
|
[] b - toggle SPACEs before TAB visualization
|
|
|
|
|
[] l - toggle \"long lines\" visualization
|
2008-01-26 01:47:21 +00:00
|
|
|
|
[] L - toggle \"long lines\" tail visualization
|
2008-01-21 12:45:58 +00:00
|
|
|
|
[] n - toggle NEWLINE visualization
|
2008-01-25 14:09:57 +00:00
|
|
|
|
[] i - toggle indentation SPACEs visualization
|
|
|
|
|
[] e - toggle empty line at bob and/or eob visualization
|
|
|
|
|
[] a - toggle SPACEs after TAB visualization
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
[] c - toggle color faces
|
|
|
|
|
[] m - toggle visual mark
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
x - restore `whitespace-chars' value
|
|
|
|
|
z - restore `whitespace-style' value
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
? - display this text\n\n"
|
2008-01-31 16:08:29 +00:00
|
|
|
|
"Text for whitespace toggle options.")
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defconst whitespace-help-buffer-name "*Whitespace Toggle Options*"
|
|
|
|
|
"The buffer name for whitespace toggle options.")
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-03-01 19:00:24 +00:00
|
|
|
|
(defun whitespace-mark-x (nchars condition)
|
|
|
|
|
"Insert the mark ('X' or ' ') after NCHARS depending on CONDITION."
|
|
|
|
|
(forward-char nchars)
|
|
|
|
|
(insert (if condition "X" " ")))
|
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-insert-option-mark (the-list the-value)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"Insert the option mark ('X' or ' ') in toggle options buffer."
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(dolist (sym the-list)
|
|
|
|
|
(forward-line 1)
|
2008-03-01 19:00:24 +00:00
|
|
|
|
(whitespace-mark-x 2 (memq sym the-value))))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-help-on (chars style)
|
|
|
|
|
"Display the whitespace toggle options."
|
|
|
|
|
(unless (get-buffer whitespace-help-buffer-name)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(delete-other-windows)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(let ((buffer (get-buffer-create whitespace-help-buffer-name)))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(set-buffer buffer)
|
|
|
|
|
(erase-buffer)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(insert whitespace-help-text)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(goto-char (point-min))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(whitespace-insert-option-mark
|
|
|
|
|
whitespace-chars-value-list chars)
|
|
|
|
|
(whitespace-insert-option-mark
|
|
|
|
|
whitespace-style-value-list style)
|
2008-03-01 19:00:24 +00:00
|
|
|
|
(whitespace-display-window buffer)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun whitespace-display-window (buffer)
|
|
|
|
|
"Display BUFFER in a new window."
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(set-buffer-modified-p nil)
|
|
|
|
|
(let ((size (- (window-height)
|
|
|
|
|
(max window-min-height
|
|
|
|
|
(1+ (count-lines (point-min)
|
|
|
|
|
(point-max)))))))
|
|
|
|
|
(when (<= size 0)
|
|
|
|
|
(kill-buffer buffer)
|
|
|
|
|
(error "Frame height is too small; \
|
2008-01-31 16:08:29 +00:00
|
|
|
|
can't split window to display whitespace toggle options"))
|
2008-03-01 19:00:24 +00:00
|
|
|
|
(set-window-buffer (split-window nil size) buffer)))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-help-off ()
|
|
|
|
|
"Remove the buffer and window of the whitespace toggle options."
|
|
|
|
|
(let ((buffer (get-buffer whitespace-help-buffer-name)))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(when buffer
|
|
|
|
|
(delete-windows-on buffer)
|
|
|
|
|
(kill-buffer buffer))))
|
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-interactive-char (local-p)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"Interactive function to read a char and return a symbol.
|
|
|
|
|
|
|
|
|
|
If LOCAL-P is non-nil, it uses a local context; otherwise, it
|
|
|
|
|
uses a global context.
|
|
|
|
|
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
It accepts one of the following chars:
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
CHAR MEANING
|
2008-01-21 12:45:58 +00:00
|
|
|
|
t toggle TAB visualization
|
|
|
|
|
s toggle SPACE and HARD SPACE visualization
|
|
|
|
|
r toggle trailing blanks visualization
|
|
|
|
|
b toggle SPACEs before TAB visualization
|
|
|
|
|
l toggle \"long lines\" visualization
|
2008-01-26 01:47:21 +00:00
|
|
|
|
L toggle \"long lines\" tail visualization
|
2008-01-21 12:45:58 +00:00
|
|
|
|
n toggle NEWLINE visualization
|
2008-01-25 14:09:57 +00:00
|
|
|
|
i toggle indentation SPACEs visualization
|
|
|
|
|
e toggle empty line at bob and/or eob visualization
|
|
|
|
|
a toggle SPACEs after TAB visualization
|
2008-01-17 12:46:55 +00:00
|
|
|
|
c toggle color faces
|
|
|
|
|
m toggle visual mark
|
2008-01-31 16:08:29 +00:00
|
|
|
|
x restore `whitespace-chars' value
|
|
|
|
|
z restore `whitespace-style' value
|
2008-01-17 12:46:55 +00:00
|
|
|
|
? display brief help
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
See also `whitespace-toggle-option-alist'."
|
|
|
|
|
(let* ((is-off (not (if local-p
|
|
|
|
|
whitespace-mode
|
|
|
|
|
global-whitespace-mode)))
|
|
|
|
|
(chars (cond (is-off whitespace-chars) ; use default value
|
|
|
|
|
(local-p whitespace-active-chars)
|
|
|
|
|
(t whitespace-toggle-chars)))
|
|
|
|
|
(style (cond (is-off whitespace-style) ; use default value
|
|
|
|
|
(local-p whitespace-active-style)
|
|
|
|
|
(t whitespace-toggle-style)))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(prompt
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(format "Whitespace Toggle %s (type ? for further options)-"
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(if local-p "Local" "Global")))
|
|
|
|
|
ch sym)
|
|
|
|
|
;; read a valid option and get the corresponding symbol
|
|
|
|
|
(save-window-excursion
|
|
|
|
|
(condition-case data
|
|
|
|
|
(progn
|
|
|
|
|
(while
|
|
|
|
|
;; while condition
|
|
|
|
|
(progn
|
|
|
|
|
(setq ch (read-char prompt))
|
|
|
|
|
(not
|
|
|
|
|
(setq sym
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(cdr
|
|
|
|
|
(assq ch whitespace-toggle-option-alist)))))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; while body
|
|
|
|
|
(if (eq ch ?\?)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(whitespace-help-on chars style)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(ding)))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(whitespace-help-off)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(message " ")) ; clean echo area
|
|
|
|
|
;; handler
|
|
|
|
|
((quit error)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(whitespace-help-off)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(error (error-message-string data)))))
|
|
|
|
|
(list sym))) ; return the apropriate symbol
|
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-toggle-list (local-p arg the-list default-list
|
|
|
|
|
sym-restore sym-list)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"Toggle options in THE-LIST based on list ARG.
|
|
|
|
|
|
|
|
|
|
If LOCAL-P is non-nil, it uses a local context; otherwise, it
|
|
|
|
|
uses a global context.
|
|
|
|
|
|
|
|
|
|
ARG is a list of options to be toggled.
|
|
|
|
|
|
|
|
|
|
THE-LIST is a list of options. This list will be toggled and the
|
|
|
|
|
resultant list will be returned.
|
|
|
|
|
|
|
|
|
|
DEFAULT-LIST is the default list of options. It is used to
|
|
|
|
|
restore the options in THE-LIST.
|
|
|
|
|
|
|
|
|
|
SYM-RESTORE is the symbol which indicates to restore the options
|
|
|
|
|
in THE-LIST.
|
|
|
|
|
|
|
|
|
|
SYM-LIST is a list of valid options, used to check if the ARG's
|
|
|
|
|
options are valid."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(unless (if local-p whitespace-mode global-whitespace-mode)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(setq the-list default-list))
|
|
|
|
|
(setq the-list (copy-sequence the-list)) ; keep original list
|
|
|
|
|
(dolist (sym (if (listp arg) arg (list arg)))
|
|
|
|
|
(cond
|
|
|
|
|
;; restore default values
|
|
|
|
|
((eq sym sym-restore)
|
|
|
|
|
(setq the-list default-list))
|
|
|
|
|
;; toggle valid values
|
|
|
|
|
((memq sym sym-list)
|
|
|
|
|
(setq the-list (if (memq sym the-list)
|
|
|
|
|
(delq sym the-list)
|
|
|
|
|
(cons sym the-list))))))
|
|
|
|
|
the-list)
|
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-turn-on ()
|
|
|
|
|
"Turn on whitespace visualization."
|
2008-03-01 19:00:24 +00:00
|
|
|
|
(whitespace-add-local-hook)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(setq whitespace-active-style (if (listp whitespace-style)
|
|
|
|
|
whitespace-style
|
|
|
|
|
(list whitespace-style)))
|
|
|
|
|
(setq whitespace-active-chars (if (listp whitespace-chars)
|
|
|
|
|
whitespace-chars
|
|
|
|
|
(list whitespace-chars)))
|
|
|
|
|
(when (memq 'color whitespace-active-style)
|
|
|
|
|
(whitespace-color-on))
|
|
|
|
|
(when (memq 'mark whitespace-active-style)
|
|
|
|
|
(whitespace-display-char-on)))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-turn-off ()
|
(whitespace): Set :version tag to 23.1.
(whitespace-turn-off, whitespace-toggle-options): Fix typos.
(whitespace-style, whitespace-chars, whitespace-space, whitespace-hspace,
whitespace-tab, whitespace-newline, whitespace-trailing, whitespace-line,
whitespace-space-before-tab, whitespace-indentation, whitespace-empty,
whitespace-space-after-tab, whitespace-hspace-regexp, whitespace-space-regexp,
whitespace-tab-regexp, whitespace-trailing-regexp,
whitespace-space-before-tab-regexp, whitespace-indentation-regexp,
whitespace-empty-at-bob-regexp, whitespace-empty-at-eob-regexp,
whitespace-space-after-tab-regexp, whitespace-line-column,
whitespace-display-mappings, global-whitespace-toggle-options,
whitespace-cleanup, whitespace-cleanup-region, whitespace-interactive-char):
Doc fixes.
2008-02-01 14:44:44 +00:00
|
|
|
|
"Turn off whitespace visualization."
|
2008-03-01 19:00:24 +00:00
|
|
|
|
(whitespace-remove-local-hook)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (memq 'color whitespace-active-style)
|
|
|
|
|
(whitespace-color-off))
|
|
|
|
|
(when (memq 'mark whitespace-active-style)
|
|
|
|
|
(whitespace-display-char-off)))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-color-on ()
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"Turn on color visualization."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when whitespace-active-chars
|
|
|
|
|
(unless whitespace-font-lock
|
|
|
|
|
(setq whitespace-font-lock t
|
|
|
|
|
whitespace-font-lock-keywords
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(copy-sequence font-lock-keywords)))
|
|
|
|
|
;; turn off font lock
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(setq whitespace-font-lock-mode font-lock-mode)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(font-lock-mode 0)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;; add whitespace-mode color into font lock
|
|
|
|
|
(when (memq 'spaces whitespace-active-chars)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
nil
|
|
|
|
|
(list
|
|
|
|
|
;; Show SPACEs
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(list whitespace-space-regexp 1 whitespace-space t)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; Show HARD SPACEs
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(list whitespace-hspace-regexp 1 whitespace-hspace t))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
t))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (memq 'tabs whitespace-active-chars)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
nil
|
|
|
|
|
(list
|
|
|
|
|
;; Show TABs
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(list whitespace-tab-regexp 1 whitespace-tab t))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
t))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (memq 'trailing whitespace-active-chars)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
nil
|
|
|
|
|
(list
|
|
|
|
|
;; Show trailing blanks
|
2008-03-01 19:00:24 +00:00
|
|
|
|
(list (whitespace-trailing-regexp) 1 whitespace-trailing t))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
t))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (or (memq 'lines whitespace-active-chars)
|
|
|
|
|
(memq 'lines-tail whitespace-active-chars))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
nil
|
|
|
|
|
(list
|
|
|
|
|
;; Show "long" lines
|
2008-01-26 01:47:21 +00:00
|
|
|
|
(list
|
|
|
|
|
(format
|
|
|
|
|
"^\\([^\t\n]\\{%s\\}\\|[^\t\n]\\{0,%s\\}\t\\)\\{%d\\}%s\\(.+\\)$"
|
|
|
|
|
tab-width (1- tab-width)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(/ whitespace-line-column tab-width)
|
|
|
|
|
(let ((rem (% whitespace-line-column tab-width)))
|
2008-01-26 01:47:21 +00:00
|
|
|
|
(if (zerop rem)
|
|
|
|
|
""
|
|
|
|
|
(format ".\\{%d\\}" rem))))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(if (memq 'lines whitespace-active-chars)
|
2008-01-26 01:47:21 +00:00
|
|
|
|
0 ; whole line
|
|
|
|
|
2) ; line tail
|
2008-01-31 16:08:29 +00:00
|
|
|
|
whitespace-line t))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
t))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (memq 'space-before-tab whitespace-active-chars)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
nil
|
|
|
|
|
(list
|
|
|
|
|
;; Show SPACEs before TAB
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(list whitespace-space-before-tab-regexp
|
|
|
|
|
1 whitespace-space-before-tab t))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
t))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (memq 'indentation whitespace-active-chars)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
nil
|
|
|
|
|
(list
|
|
|
|
|
;; Show indentation SPACEs
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(list whitespace-indentation-regexp
|
|
|
|
|
1 whitespace-indentation t))
|
2008-01-25 14:09:57 +00:00
|
|
|
|
t))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (memq 'empty whitespace-active-chars)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
nil
|
|
|
|
|
(list
|
|
|
|
|
;; Show empty lines at beginning of buffer
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(list whitespace-empty-at-bob-regexp
|
|
|
|
|
1 whitespace-empty t))
|
2008-01-25 14:09:57 +00:00
|
|
|
|
t)
|
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
nil
|
|
|
|
|
(list
|
|
|
|
|
;; Show empty lines at end of buffer
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(list whitespace-empty-at-eob-regexp
|
|
|
|
|
1 whitespace-empty t))
|
2008-01-25 14:09:57 +00:00
|
|
|
|
t))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (memq 'space-after-tab whitespace-active-chars)
|
2008-01-25 14:09:57 +00:00
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
nil
|
|
|
|
|
(list
|
|
|
|
|
;; Show SPACEs after TAB
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(list whitespace-space-after-tab-regexp
|
|
|
|
|
1 whitespace-space-after-tab t))
|
2008-01-25 14:09:57 +00:00
|
|
|
|
t))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; now turn on font lock and highlight blanks
|
|
|
|
|
(font-lock-mode 1)))
|
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-color-off ()
|
2008-01-21 12:45:58 +00:00
|
|
|
|
"Turn off color visualization."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when whitespace-active-chars
|
2008-01-21 12:45:58 +00:00
|
|
|
|
;; turn off font lock
|
|
|
|
|
(font-lock-mode 0)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when whitespace-font-lock
|
|
|
|
|
(setq whitespace-font-lock nil
|
|
|
|
|
font-lock-keywords whitespace-font-lock-keywords))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; restore original font lock state
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(font-lock-mode whitespace-font-lock-mode)))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;;; Hacked from visws.el (Miles Bader <miles@gnu.org>)
|
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defvar whitespace-display-table nil
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"Used to save a local display table.")
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(make-variable-buffer-local 'whitespace-display-table)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defvar whitespace-display-table-was-local nil
|
|
|
|
|
"Used to remember whether a buffer initially had a local display table.")
|
|
|
|
|
(make-variable-buffer-local 'whitespace-display-table-was-local)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defsubst whitespace-char-valid-p (char)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; This check should be improved!!!
|
|
|
|
|
(or (< char 256)
|
2008-02-02 04:17:54 +00:00
|
|
|
|
(characterp char)))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-display-vector-p (vec)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"Return true if every character in vector VEC can be displayed."
|
|
|
|
|
(let ((i (length vec)))
|
|
|
|
|
(when (> i 0)
|
|
|
|
|
(while (and (>= (setq i (1- i)) 0)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(whitespace-char-valid-p (aref vec i))))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(< i 0))))
|
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-display-char-on ()
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"Turn on character display mapping."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when whitespace-display-mappings
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(let (vecs vec)
|
|
|
|
|
;; Remember whether a buffer has a local display table.
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(unless whitespace-display-table-was-local
|
|
|
|
|
(setq whitespace-display-table-was-local t
|
|
|
|
|
whitespace-display-table
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(copy-sequence buffer-display-table)))
|
|
|
|
|
(unless buffer-display-table
|
|
|
|
|
(setq buffer-display-table (make-display-table)))
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(dolist (entry whitespace-display-mappings)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(setq vecs (cdr entry))
|
|
|
|
|
;; Get a displayable mapping.
|
|
|
|
|
(while (and vecs
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(not (whitespace-display-vector-p (car vecs))))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(setq vecs (cdr vecs)))
|
|
|
|
|
;; Display a valid mapping.
|
|
|
|
|
(when vecs
|
|
|
|
|
(setq vec (copy-sequence (car vecs)))
|
|
|
|
|
(cond
|
|
|
|
|
;; Any char except newline
|
|
|
|
|
((not (eq (car entry) ?\n))
|
|
|
|
|
(aset buffer-display-table (car entry) vec))
|
|
|
|
|
;; Newline char - display it
|
2008-01-31 16:08:29 +00:00
|
|
|
|
((memq 'newline whitespace-active-chars)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; Only insert face bits on NEWLINE char mapping to avoid
|
|
|
|
|
;; obstruction of other faces like TABs and (HARD) SPACEs
|
|
|
|
|
;; faces, font-lock faces, etc.
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(when (memq 'color whitespace-active-style)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
(dotimes (i (length vec))
|
|
|
|
|
(or (eq (aref vec i) ?\n)
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(aset vec i
|
|
|
|
|
(make-glyph-code (aref vec i)
|
|
|
|
|
whitespace-newline)))))
|
2008-01-17 12:46:55 +00:00
|
|
|
|
;; Display mapping
|
|
|
|
|
(aset buffer-display-table (car entry) vec))
|
|
|
|
|
;; Newline char - don't display it
|
|
|
|
|
(t
|
|
|
|
|
;; Do nothing
|
|
|
|
|
)))))))
|
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(defun whitespace-display-char-off ()
|
2008-01-17 12:46:55 +00:00
|
|
|
|
"Turn off character display mapping."
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(and whitespace-display-mappings
|
|
|
|
|
whitespace-display-table-was-local
|
|
|
|
|
(setq whitespace-display-table-was-local nil
|
|
|
|
|
buffer-display-table whitespace-display-table)))
|
2008-01-28 13:58:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2008-03-01 19:00:24 +00:00
|
|
|
|
;;;; Hook
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun whitespace-action-when-on ()
|
|
|
|
|
"Action to be taken always when local whitespace is turned on."
|
|
|
|
|
(cond ((memq 'cleanup whitespace-action)
|
|
|
|
|
(whitespace-cleanup))
|
|
|
|
|
((memq 'report-on-bogus whitespace-action)
|
|
|
|
|
(whitespace-report nil t))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun whitespace-add-local-hook ()
|
|
|
|
|
"Add some whitespace hooks locally."
|
|
|
|
|
(add-hook 'write-file-functions 'whitespace-write-file-hook nil t)
|
|
|
|
|
(add-hook 'kill-buffer-hook 'whitespace-kill-buffer-hook nil t))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun whitespace-remove-local-hook ()
|
|
|
|
|
"Remove some whitespace hooks locally."
|
|
|
|
|
(remove-hook 'write-file-functions 'whitespace-write-file-hook t)
|
|
|
|
|
(remove-hook 'kill-buffer-hook 'whitespace-kill-buffer-hook t))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun whitespace-write-file-hook ()
|
|
|
|
|
"Action to be taken when buffer is written.
|
|
|
|
|
It should be added buffer-locally to `write-file-functions'."
|
|
|
|
|
(when (whitespace-action)
|
|
|
|
|
(error "Abort write due to whitespace problems in %s"
|
|
|
|
|
(buffer-name)))
|
|
|
|
|
nil) ; continue hook processing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun whitespace-kill-buffer-hook ()
|
|
|
|
|
"Action to be taken when buffer is killed.
|
|
|
|
|
It should be added buffer-locally to `kill-buffer-hook'."
|
|
|
|
|
(whitespace-action)
|
|
|
|
|
nil) ; continue hook processing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun whitespace-action ()
|
|
|
|
|
"Action to be taken when buffer is killed or written.
|
|
|
|
|
Return t when the action should be aborted."
|
|
|
|
|
(cond ((memq 'auto-cleanup whitespace-action)
|
|
|
|
|
(whitespace-cleanup)
|
|
|
|
|
nil)
|
|
|
|
|
((memq 'abort-on-bogus whitespace-action)
|
|
|
|
|
(whitespace-report nil t))
|
|
|
|
|
(t
|
|
|
|
|
nil)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-02-01 11:25:16 +00:00
|
|
|
|
(defun whitespace-unload-function ()
|
2008-03-01 19:00:24 +00:00
|
|
|
|
"Unload the whitespace library."
|
|
|
|
|
(global-whitespace-mode -1)
|
|
|
|
|
;; be sure all local whitespace mode is turned off
|
|
|
|
|
(save-current-buffer
|
|
|
|
|
(dolist (buf (buffer-list))
|
|
|
|
|
(set-buffer buf)
|
|
|
|
|
(whitespace-mode -1)))
|
|
|
|
|
nil) ; continue standard unloading
|
|
|
|
|
|
2008-02-01 11:25:16 +00:00
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(provide 'whitespace)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 16:08:29 +00:00
|
|
|
|
(run-hooks 'whitespace-load-hook)
|
2008-01-17 12:46:55 +00:00
|
|
|
|
|
|
|
|
|
|
2008-01-31 22:54:22 +00:00
|
|
|
|
;; arch-tag: 1b1e2500-dbd4-4a26-8f7a-5a5edfd3c97e
|
2008-01-31 16:08:29 +00:00
|
|
|
|
;;; whitespace.el ends here
|