4

The whitespace-mode has a default mapping from whitespace characters to printable characters:

  • U+0020 → U+00B7 “·”
  • U+0009 → U+00BB “»”
  • U+000A → U+0024 “$”
  • etc.

How can I change which printable characters are used for each whitespace character? For example, to show “⇒” or “¶”.

I'm using Emacs 24.5.1.

bignose
  • 627
  • 3
  • 15
  • Open up `whitespace.el` and you'll see a few examples that are commented out as part of the variable Drew described in his answer below. `M-x find-variable RET whitespace-display-mappings RET` You can add color also by customizing the face named `whitespace-newline`. – lawlist Sep 29 '15 at 04:49

1 Answers1

4

Customize option whitespace-display-mappings. That's what it's for.

M-x customize-option whitespace-display-mappings RET

The doc gives you details (below), but just look at the Customize buffer and things will be even clearer. You can use C-u C-x = with the cursor before a given character, to see its Unicode code point.

C-h v whitespace-display-mappings RET

Specify an alist of mappings for displaying characters.

Each element has the following form:

   (KIND CHAR VECTOR...)

Where:

KIND    is the kind of character.
        It can be one of the following symbols:

        tab-mark    for TAB character

        space-mark  for SPACE or HARD SPACE character

        newline-mark    for NEWLINE character

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
`whitespace-newline' variable.

Used when `whitespace-style' includes `tab-mark', `space-mark' or
`newline-mark'.
Drew
  • 75,699
  • 9
  • 109
  • 225