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

Determine the kinds of whitespace are visualized.

The value is a list containing one or more of the following symbols:

   face visualize by using faces (see below).

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

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

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

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

   lines-tail highlighted lines which have columns beyond
                        whitespace-line-column via faces.
                        Only the part of line which goes beyond
                        whitespace-line-column column.
                        This has effect only if lines (see above)
                        is NOT present in whitespace-style,
                        and if face (see above) IS present in
                        whitespace-style.

   lines-char lines which have columns beyond
                        whitespace-line-column are highlighted via
                        putting a face on the first character that goes
                        beyond the whitespace-line-column column.
                        It has effect only if lines or
                        lines-tail (see above) is not present
                        in whitespace-style and if face (see
                        above) is present in whitespace-style.

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

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

   page-delimiters visualize page-break delimiter characters (^L)
                         as horizontal lines.
                         This has effect only if face (see above)
                         is present in whitespace-style.

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

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

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

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

   big-indent visualize big indentations via faces.
                        This has effect only if face (see above)
                        is present in whitespace-style.

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

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

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

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

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

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

   space-mark visualize SPACEs and HARD SPACEs via
                        display table.

   tab-mark visualize TABs via display table.

   newline-mark visualize NEWLINEs 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 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.

This variable was added, or its default value changed, in Emacs 31.1.

View in manual

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)
  "Determine the kinds of whitespace are visualized.

The value is a list containing one or more of the following symbols:

   face                 visualize by using faces (see below).

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

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

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

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

   lines-tail           highlighted lines which have columns beyond
                        `whitespace-line-column' via faces.
                        Only the part of line which goes beyond
                        `whitespace-line-column' column.
                        This has effect only if `lines' (see above)
                        is NOT present in `whitespace-style',
                        and if `face' (see above) IS present in
                        `whitespace-style'.

   lines-char           lines which have columns beyond
                        `whitespace-line-column' are highlighted via
                        putting a face on the first character that goes
                        beyond the `whitespace-line-column' column.
                        It has effect only if `lines' or
                        `lines-tail' (see above) is not present
                        in `whitespace-style' and if `face' (see
                        above) is present in `whitespace-style'.

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

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

   page-delimiters       visualize page-break delimiter characters (^L)
                         as horizontal lines.
                         This has effect only if `face' (see above)
                         is present in `whitespace-style'.

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

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

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

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

   big-indent           visualize big indentations via faces.
                        This has effect only if `face' (see above)
                        is present in `whitespace-style'.

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

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

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

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

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

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

   space-mark           visualize SPACEs and HARD SPACEs via
                        display table.

   tab-mark             visualize TABs via display table.

   newline-mark         visualize NEWLINEs 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 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) Lines, only first character" lines-char)
              (const :tag "(Face) NEWLINEs" newline)
              (const :tag "(Face) Missing newlines at EOB"
                     missing-newline-at-eof)
              (const :tag "(Face) Page delimiters" page-delimiters)
              (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))
  :version "31.1")