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

From: Claudio Bley <[email-masked]>
Date: Tue, 19 Nov 2013 08:37:49 +0100

1. M-x customize-option RET whitespace-display-mappings RET
2. click INS to insert an arbitrary char into one of the vectors
3. click the State button and select "Set for current session"

You should see this error / backtrace:

Debugger entered--Lisp error: (error "This field should contain a single character")
  signal(error ("This field should contain a single character"))
  error("%s" "This field should contain a single character")
  custom-variable-set((custom-variable :documentation-shown t
  :custom-state modified :tag "Whitespace Display Mappings" :value
  whitespace-display-mappings :custom-form edit :custom-magic
  [...]
  call-interactively(widget-button-click nil nil)
  command-execute(widget-button-click)

In wid-edit.el the character widget is defined as

(define-widget 'character 'editable-field
  "A character."
  :tag "Character"
  :value 0
  :size 1
  :format "%{%t%}: %v\n"
  :valid-regexp "\\`.\\'"
  :error "This field should contain a single character"
  [...]

Note, that the regexp does not match a single newline character, which
happens to be the problem here, as the default value of
`whitespace-display-mappings' is

((space-mark 32 [183] [46])
 (space-mark 160 [164] [95])
 (newline-mark 10 [36 10])  ;; <- ?\n here
 (tab-mark 9 [187 9] [92 9]))

I think the regexp should be changed to "\\`\(.\|\n\)\\'" to allow a
single newline also.

Claudio
-- 
Claudio