Variable: whitespace-style

whitespace-style is a customizable variable defined in whitespace.el.gz.

Value

(face tabs spaces trailing lines space-before-tab newline indentation empty space-after-tab space-mark tab-mark newline-mark missing-newline-at-eof)

Documentation

Specify which kind of blank is visualized.

It's a list containing some or all of the following values:

   face enable all visualization via faces (see below).

   trailing trailing blanks are visualized via faces.
                        It has effect only if face (see above)
                        is present in whitespace-style.

   tabs TABs are visualized via faces.
                        It has effect only if face (see above)
                        is present in whitespace-style.

   spaces SPACEs and HARD SPACEs are visualized via
                        faces.
                        It has effect only if face (see above)
                        is present in whitespace-style.

   lines lines which have columns beyond
                        whitespace-line-column are highlighted via
                        faces.
                        Whole line is highlighted.
                        It has precedence over lines-tail (see
                        below).
                        It has effect only if face (see above)
                        is present in whitespace-style.

   lines-tail lines which have columns beyond
                        whitespace-line-column are highlighted via
                        faces.
                        But only the part of line which goes
                        beyond whitespace-line-column column.
                        It has effect only if lines (see above)
                        is not present in whitespace-style
                        and if face (see above) is present in
                        whitespace-style.

   newline NEWLINEs are visualized via faces.
                        It has effect only if face (see above)
                        is present in whitespace-style.

   missing-newline-at-eof Missing newline at the end of the file is
                        visualized via faces.
                        It has effect only if face (see above)
                        is present in whitespace-style.

   empty empty lines at beginning and/or end of buffer
                        are visualized via faces.
                        It has effect only if face (see above)
                        is present in whitespace-style.

   indentation::tab tab-width or more SPACEs at beginning of line
                        are visualized via faces.
                        It has effect only if face (see above)
                        is present in whitespace-style.

   indentation::space TABs at beginning of line are visualized via
                        faces.
                        It has effect only if face (see above)
                        is present in whitespace-style.

   indentation tab-width or more SPACEs at beginning of line
                        are visualized, if indent-tabs-mode(var)/indent-tabs-mode(fun) (which
                        see) is non-nil; otherwise, TABs at beginning
                        of line are visualized via faces.
                        It has effect only if face (see above)
                        is present in whitespace-style.

   big-indent Big indentations are visualized via faces.
                        It has effect only if face (see above)
                        is present in whitespace-style.

   space-after-tab::tab tab-width or more SPACEs after a TAB
                                are visualized via faces.
                                It has effect only if face (see above)
                                is present in whitespace-style.

   space-after-tab::space TABs are visualized when tab-width or
                                more SPACEs occur after a TAB, via
                                faces.
                                It has effect only if face (see above)
                                is present in whitespace-style.

   space-after-tab tab-width or more SPACEs after a TAB
                                are visualized, if indent-tabs-mode(var)/indent-tabs-mode(fun)
                                (which see) is non-nil; otherwise,
                                the TABs are visualized via faces.
                                It has effect only if face (see above)
                                is present in whitespace-style.

   space-before-tab::tab SPACEs before TAB are visualized via
                                faces.
                                It has effect only if face (see above)
                                is present in whitespace-style.

   space-before-tab::space TABs are visualized when SPACEs occur
                                before TAB, via faces.
                                It has effect only if face (see above)
                                is present in whitespace-style.

   space-before-tab SPACEs before TAB are visualized, if
                                indent-tabs-mode(var)/indent-tabs-mode(fun) (which see) is
                                non-nil; otherwise, the TABs are
                                visualized via faces.
                                It has effect only if face (see above)
                                is present in whitespace-style.

   space-mark SPACEs and HARD SPACEs are visualized via
                        display table.

   tab-mark TABs are visualized via display table.

   newline-mark NEWLINEs are visualized via display table.

Any other value is ignored.

If nil, don't visualize TABs, (HARD) SPACEs and NEWLINEs via faces and via display table.

There is an evaluation order for some values, if they are included in whitespace-style list. For example, if indentation, indentation::tab and/or indentation::space are included in whitespace-style list. The evaluation order for these values is:

 * For indentation:
   1. indentation
   2. indentation::tab
   3. indentation::space

 * For SPACEs after TABs:
   1. space-after-tab
   2. space-after-tab::tab
   3. space-after-tab::space

 * For SPACEs before TABs:
   1. space-before-tab
   2. space-before-tab::tab
   3. space-before-tab::space

For example, if indentation and indentation::space are included in whitespace-style, the indentation value is used instead of the indentation::space value.

One reason to not use faces to visualize spaces (i.e., not include face in whitespace-style) is to use whitespace-mode(var)/whitespace-mode(fun) only for cleaning up a buffer. See whitespace-cleanup and whitespace-cleanup-region.

See also whitespace-display-mappings for documentation.

Probably introduced at or before Emacs version 23.1.

Source Code

;; Defined in /usr/src/emacs/lisp/whitespace.el.gz
(defcustom whitespace-style
  '(face
    tabs spaces trailing lines space-before-tab newline
    indentation empty space-after-tab
    space-mark tab-mark newline-mark
    missing-newline-at-eof)
  "Specify which kind of blank is visualized.

It's a list containing some or all of the following values:

   face                 enable all visualization via faces (see below).

   trailing             trailing blanks are visualized via faces.
                        It has effect only if `face' (see above)
                        is present in `whitespace-style'.

   tabs                 TABs are visualized via faces.
                        It has effect only if `face' (see above)
                        is present in `whitespace-style'.

   spaces               SPACEs and HARD SPACEs are visualized via
                        faces.
                        It has effect only if `face' (see above)
                        is present in `whitespace-style'.

   lines                lines which have columns beyond
                        `whitespace-line-column' are highlighted via
                        faces.
                        Whole line is highlighted.
                        It has precedence over `lines-tail' (see
                        below).
                        It has effect only if `face' (see above)
                        is present in `whitespace-style'.

   lines-tail           lines which have columns beyond
                        `whitespace-line-column' are highlighted via
                        faces.
                        But only the part of line which goes
                        beyond `whitespace-line-column' column.
                        It has effect only if `lines' (see above)
                        is not present in `whitespace-style'
                        and if `face' (see above) is present in
                        `whitespace-style'.

   newline              NEWLINEs are visualized via faces.
                        It has effect only if `face' (see above)
                        is present in `whitespace-style'.

   missing-newline-at-eof Missing newline at the end of the file is
                        visualized via faces.
                        It has effect only if `face' (see above)
                        is present in `whitespace-style'.

   empty                empty lines at beginning and/or end of buffer
                        are visualized via faces.
                        It has effect only if `face' (see above)
                        is present in `whitespace-style'.

   indentation::tab     `tab-width' or more SPACEs at beginning of line
                        are visualized via faces.
                        It has effect only if `face' (see above)
                        is present in `whitespace-style'.

   indentation::space   TABs at beginning of line are visualized via
                        faces.
                        It has effect only if `face' (see above)
                        is present in `whitespace-style'.

   indentation          `tab-width' or more SPACEs at beginning of line
                        are visualized, if `indent-tabs-mode' (which
                        see) is non-nil; otherwise, TABs at beginning
                        of line are visualized via faces.
                        It has effect only if `face' (see above)
                        is present in `whitespace-style'.

   big-indent           Big indentations are visualized via faces.
                        It has effect only if `face' (see above)
                        is present in `whitespace-style'.

   space-after-tab::tab         `tab-width' or more SPACEs after a TAB
                                are visualized via faces.
                                It has effect only if `face' (see above)
                                is present in `whitespace-style'.

   space-after-tab::space       TABs are visualized when `tab-width' or
                                more SPACEs occur after a TAB, via
                                faces.
                                It has effect only if `face' (see above)
                                is present in `whitespace-style'.

   space-after-tab              `tab-width' or more SPACEs after a TAB
                                are visualized, if `indent-tabs-mode'
                                (which see) is non-nil; otherwise,
                                the TABs are visualized via faces.
                                It has effect only if `face' (see above)
                                is present in `whitespace-style'.

   space-before-tab::tab        SPACEs before TAB are visualized via
                                faces.
                                It has effect only if `face' (see above)
                                is present in `whitespace-style'.

   space-before-tab::space      TABs are visualized when SPACEs occur
                                before TAB, via faces.
                                It has effect only if `face' (see above)
                                is present in `whitespace-style'.

   space-before-tab             SPACEs before TAB are visualized, if
                                `indent-tabs-mode' (which see) is
                                non-nil; otherwise, the TABs are
                                visualized via faces.
                                It has effect only if `face' (see above)
                                is present in `whitespace-style'.

   space-mark           SPACEs and HARD SPACEs are visualized via
                        display table.

   tab-mark             TABs are visualized via display table.

   newline-mark         NEWLINEs are visualized via display table.

Any other value is ignored.

If nil, don't visualize TABs, (HARD) SPACEs and NEWLINEs via faces and
via display table.

There is an evaluation order for some values, if they are
included in `whitespace-style' list.  For example, if
indentation, indentation::tab and/or indentation::space are
included in `whitespace-style' list.  The evaluation order for
these values is:

 * For indentation:
   1. indentation
   2. indentation::tab
   3. indentation::space

 * For SPACEs after TABs:
   1. space-after-tab
   2. space-after-tab::tab
   3. space-after-tab::space

 * For SPACEs before TABs:
   1. space-before-tab
   2. space-before-tab::tab
   3. space-before-tab::space

For example, if `indentation' and `indentation::space' are
included in `whitespace-style', the `indentation' value is used
instead of the `indentation::space' value.

One reason to not use faces to visualize spaces (i.e., not
include `face' in `whitespace-style') is to use `whitespace-mode'
only for cleaning up a buffer.  See `whitespace-cleanup' and
`whitespace-cleanup-region'.

See also `whitespace-display-mappings' for documentation."
  :type '(set :tag "Kind of Blank"
              (const :tag "(Face) Face visualization" face)
              (const :tag "(Face) Trailing TABs, SPACEs and HARD SPACEs"
                     trailing)
              (const :tag "(Face) TABs" tabs)
              (const :tag "(Face) SPACEs and HARD SPACEs" spaces)
              (const :tag "(Face) Lines" lines)
              (const :tag "(Face) Lines, only overlong part" lines-tail)
              (const :tag "(Face) NEWLINEs" newline)
              (const :tag "(Face) Missing newlines at EOB"
                     missing-newline-at-eof)
              (const :tag "(Face) Empty Lines At BOB And/Or EOB" empty)
              (const :tag "(Face) Indentation SPACEs" indentation::tab)
              (const :tag "(Face) Indentation TABs"
                     indentation::space)
              (const :tag "(Face) Indentation TABs or SPACEs" indentation)
              (const :tag "(Face) Too much line indentation" big-indent)
              (const :tag "(Face) SPACEs after TAB: SPACEs"
                     space-after-tab::tab)
              (const :tag "(Face) SPACEs after TAB: TABs"
                     space-after-tab::space)
              (const :tag "(Face) SPACEs after TAB" space-after-tab)
              (const :tag "(Face) SPACEs before TAB: SPACEs"
                     space-before-tab::tab)
              (const :tag "(Face) SPACEs before TAB: TABs"
                     space-before-tab::space)
              (const :tag "(Face) SPACEs before TAB" space-before-tab)
              (const :tag "(Mark) SPACEs and HARD SPACEs" space-mark)
              (const :tag "(Mark) TABs" tab-mark)
              (const :tag "(Mark) NEWLINEs" newline-mark))
  :group 'whitespace)