From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Andrus Newsgroups: gmane.emacs.bugs Subject: bug#21771: 25.0.50; Can't customize whitespace-display-mappings Date: Tue, 29 Dec 2015 20:38:49 -0700 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 9.1 \(3096.5\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1451446770 25335 80.91.229.3 (30 Dec 2015 03:39:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Dec 2015 03:39:30 +0000 (UTC) To: 21771@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 30 04:39:18 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aE7bV-0000I1-RM for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Dec 2015 04:39:13 +0100 Original-Received: from localhost ([::1]:51032 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aE7bS-0001i2-Ro for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Dec 2015 22:39:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aE7bP-0001hm-DE for bug-gnu-emacs@gnu.org; Tue, 29 Dec 2015 22:39:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aE7bK-0003w5-Cx for bug-gnu-emacs@gnu.org; Tue, 29 Dec 2015 22:39:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aE7bK-0003vk-63 for bug-gnu-emacs@gnu.org; Tue, 29 Dec 2015 22:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aE7bJ-0003Qa-UB for bug-gnu-emacs@gnu.org; Tue, 29 Dec 2015 22:39:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Ivan Andrus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Dec 2015 03:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21771 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21771-submit@debbugs.gnu.org id=B21771.145144673913168 (code B ref 21771); Wed, 30 Dec 2015 03:39:01 +0000 Original-Received: (at 21771) by debbugs.gnu.org; 30 Dec 2015 03:38:59 +0000 Original-Received: from localhost ([127.0.0.1]:49199 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aE7bG-0003QJ-Ss for submit@debbugs.gnu.org; Tue, 29 Dec 2015 22:38:59 -0500 Original-Received: from mail-ob0-f182.google.com ([209.85.214.182]:34575) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aE7bF-0003Q6-5b for 21771@debbugs.gnu.org; Tue, 29 Dec 2015 22:38:57 -0500 Original-Received: by mail-ob0-f182.google.com with SMTP id wp13so36610079obc.1 for <21771@debbugs.gnu.org>; Tue, 29 Dec 2015 19:38:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=IVRlcLyfq8n82w7WqqO3aW9dhL/KO//rQDQq61UME9w=; b=dD89uz+iwc+0MCXa5t0eBdtA18dGibBEfp6n8Fz9GvMPeqS03FnkyYjuqh8bBJT6yo fthRb1DFOqX/K7lcxLKxfI20hlU9cSdVJGaqc9T8vBzQvT3Ljge/oW4osUxxmVesKGym 2GFy5Er8hFbCK2Q2s1gPxwi4jU1RbL7b87/XfoMksXnF7Mt38GzXaOQWOkJqXBfcbObW R1pmoS+LsVVKv232pC+xjLC+RYLDlqnHVcl3+5Uc4BfNAn3ohmVbZ4W6hbBD6DDgc9NO s69MCDkO8GUt8ctGF1VJmvcSfnnbcg7Q+zW8RGr5KiTVJC5HhRhtN3go4vnpiEG3fmBA wg9w== X-Received: by 10.60.76.65 with SMTP id i1mr3820273oew.5.1451446731470; Tue, 29 Dec 2015 19:38:51 -0800 (PST) Original-Received: from [192.168.0.3] (174-23-112-137.slkc.qwest.net. [174.23.112.137]) by smtp.gmail.com with ESMTPSA id l188sm22429776oia.14.2015.12.29.19.38.50 for <21771@debbugs.gnu.org> (version=TLSv1/SSLv3 cipher=OTHER); Tue, 29 Dec 2015 19:38:50 -0800 (PST) X-Mailer: Apple Mail (2.3096.5) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:111002 Archived-At: Ivan Andrus writes: > This might be related to bug #2689, > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=2689 > > ;; emacs -Q > ;; Evaluated > (require 'whitespace) > (customize-variable 'whitespace-display-mappings) > ;; Change anything, say deleting one of space mappings > ;; Try to save > ;; Get the error > custom-variable-set: This field should contain a single character > > -Ivan It turns out this is due to one of the characters being a newline. There are two problems. First, the validation regex doesn't match a newline. This is easily addressed with the following patch: diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index d0410aa..55e8ac7 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -3400,7 +3400,7 @@ 'character :value 0 :size 1 :format "%{%t%}: %v\n" - :valid-regexp "\\`.\\'" + :valid-regexp "\\`\\(.\\|\n\\)\\'" :error "This field should contain a single character" :value-get (lambda (w) (widget-field-value-get w t)) :value-to-internal (lambda (_widget value) Second, a string consisting of only a newline is returned as an empty string from `widget-field-value-get' even with `no-truncate' non-nil. I have worked around this, but I suspect it's a suboptimal solution. It seems like the special handling of newlines is probably intended, so a "proper" solution might be tricky. diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 55e8ac7..7ff4ac2 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -3406,7 +3406,9 @@ 'character :value-to-internal (lambda (_widget value) (if (stringp value) value - (char-to-string value))) + (if (eq value ?\n) + "\n\n" + (char-to-string value)))) :value-to-external (lambda (_widget value) (if (stringp value) (aref value 0) Any pointers as to a better fix (or if this is sufficient) and/or how to write a test for this would be much appreciated. -Ivan