Subject: Customize always reports error when trying to enter characters to Whitespace Mode display mappings

From: Andrew Toskin <[email-masked]>
Date: Mon, 21 Aug 2017 21:54:08 -0700

## The problem

Customize throws an error when trying to set characters in the Whitespace
Mode display mappings. When I paste the symbols I want into the Customize
fields, it says "This field should contain a single character." Even though
I've only deleted and entered a single character! There's a lot more
documentation about the syntax of setting the variable in code than through
the Customize interface, so I'm not sure if Customize is broken or if I'm
misunderstanding something. But when trying to edit more than one display
mapping, this error is at least vague and unhelpful.

## My system setup

* Fedora 26 Workstation x86_64
* Emacs 25.2.1 in an X window, with GTK+ 3.22.16
* Whitespace Mode 13.2.2 (packaged with Emacs, in Fedora)

## Steps to reproduce

1. Launch Emacs without any other configuration (`emacs --quick`).
2. Execute Customize and search for Whitespace Display Mappings.
3. Edit the character mapping. For example, delete the default "$" used for
newlines, and paste "↵" (U+21b5 "Downwards Arrow With Corner Leftward").
4. Click Apply. See the error in the mode line at the bottom of Emacs

I thought at first that Customize wasn't accepting Unicode characters that
might be more than a single byte, but I actually tried resetting all
mappings to default, then editing the newline mapping to replace the
default "$" with another ASCII character, "&", and it **still** says "This
field should contain a single character."

I ended up setting the display mapping manually from my config file.

  (setq whitespace-display-mappings '(
        ;; Plain space: · or .
        (space-mark   32  [183]     [46]            )
        ;; Non-breaking "hard" space: • or _
        (space-mark   160 [8226]    [95]            )
        ;; Newline: ↵ or ¬ or $
        (newline-mark 10  [8629 10] [172 10] [36 10])
        ;; Tab: ⇥ or » or \
        (tab-mark     9   [8677 9]  [187 9]  [92 9] )))

**This** works as expected.

But I can't figure out why I couldn't do this in Customize. What do you
think?

Thank,
~ Andrew