Subject: Re: bug#15925: 24.3.50; error when customizing whitespace-display-mappings

From: Mauro Aranda <[email-masked]>
Date: Sat, 26 Sep 2020 10:45:56 -0300

Lars Ingebrigtsen <[email-masked]> writes:

> (Oops.  Sent the previous mail too early.)
>
> Mauro Aranda <[email-masked]> writes:
>
>> How does the attached patch look? I didn't include changes for the rest
>> of the escape sequences, because of Eli's objections.
>
> Looks good.  The only thing that's confusing now is that if you delete
> the char, it displays as \s?
>
> M-x customize-variable RET whitespace-display-mappings RET
>
>
>
>
> Hit DEL:
>
>
>
>
>
> So there's no difference in the display between a missing character and
> a space character...

I did that on purpose, and this comment tries to explain that:
;; The character widget is not really empty:
;; its value is a single space character.
;; We need to propertize it again, if it became empty for a while.

Try the following in current master (i.e., without my patch applied):

(defcustom foo-option ?. "..."
  :type 'character
  :group 'emacs)

Eval, and confirm that foo-option value is ?.

M-x customize-option RET foo-option RET

Delete the ".", and then click State and Set for Current Session.
You'll see that foo-option was set...but to what? You said there is a
missing character, but really there's not such thing: there is a space
there, and the Widget library will return ?\s for the value of that
widget.

If you do:
M-: foo-option RET
you can confirm foo-option was set to ?\s

That's why I thought it would be less confusing to show the \s at all
times, and say "No, you can't have an empty character widget".  Having a
truly empty character widget wouldn't be of much help, since the
:validate function will complain anyway because the widget doesn't have
a single character.