GNU bug report logs -
#21771
25.0.50; Can't customize whitespace-display-mappings
Previous Next
Reported by: Ivan Andrus <darthandrus <at> gmail.com>
Date: Tue, 27 Oct 2015 21:00:05 UTC
Severity: normal
Tags: fixed, patch
Merged with 15925,
28183,
31869
Found in versions 24.3.50, 25.0.50, 27.0.50
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21771 in the body.
You can then email your comments to 21771 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21771
; Package
emacs
.
(Tue, 27 Oct 2015 21:00:06 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ivan Andrus <darthandrus <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 27 Oct 2015 21:00:07 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
In GNU Emacs 25.0.50.6 (x86_64-apple-darwin14.5.0, NS appkit-1348.17
Version 10.10.5 (Build 14F27))
of 2015-10-21
Repository revision: ecba9093844fb32756923e3124f6c1dbc0dc7a79
Windowing system distributor 'Apple', version 10.3.1404
Configured using:
'configure --with-ns PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig --with-xpm'
Configured features:
JPEG RSVG IMAGEMAGICK DBUS ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS
NS
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
Resetting customization items...done
Creating customization setup...done
You can run the command ‘customize-variable’ with M-x c-var RET
Creating customization setup...done
custom-variable-set: This field should contain a single character [2 times]
Mark set [2 times]
kill-region: Buffer is read-only: #<buffer *Messages*>
Mark set
<C-s-268632064> is undefined
Undo! [2 times]
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message dired format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils filecache whitespace help-fns help-mode
cus-edit easymenu cus-start cus-load wid-edit cl-loaddefs pcase cl-lib
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel ns-win term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind cocoa ns multi-tty
make-network-process emacs)
Memory information:
((conses 16 106811 7389)
(symbols 48 20947 0)
(miscs 40 721 530)
(strings 32 17666 4716)
(string-bytes 1 492986)
(vectors 16 11943)
(vector-slots 8 424806 7171)
(floats 8 141 392)
(intervals 56 780 11)
(buffers 976 14))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21771
; Package
emacs
.
(Wed, 30 Dec 2015 03:39:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 21771 <at> debbugs.gnu.org (full text, mbox):
Ivan Andrus <darthandrus <at> gmail.com> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21771
; Package
emacs
.
(Sat, 02 Jan 2016 00:25:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 21771 <at> debbugs.gnu.org (full text, mbox):
On Thu, Dec 31, 2015 at 7:17 PM, Glenn Morris <rgm <at> gnu.org> wrote:
> Ivan Andrus wrote:
>
>>> This might be related to bug #2689,
>>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=2689
>
>> - :valid-regexp "\\`.\\'"
>> + :valid-regexp "\\`\\(.\\|\n\\)\\'"
>
> Note that this reintroduces part of the patch for #2689, which I had to
> revert since it caused a worse problem (#3136) than the one it solved.
> (I haven't checked whether the same issue applies now to your patch, but
> you should.)
Thanks for bringing that to my attention. My patch doesn’t cause 3136,
because it doesn’t really solve the problem. It just works around it by
using "\n\n" to mean "\n".
It does make things a little weird because there is a difference between
when it starts out as a newline and when it’s changed to a newline. That
is, with my patch, if you customize white `whitespace-display-mappings’,
you’ll see it displayed as "\n\n". If you change it to (say) "d" it
will be displayed as "d\n". It saves 'd' fine, but if you customize it
again it will display as "d". Changing this to "\n" will cause it to
display as "\n" and it will save "\n". Customizing again will show "\n\n"
again.
But given that the alternative causes #3136, maybe it’s not so bad.
-Ivan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21771
; Package
emacs
.
(Sat, 02 Jan 2016 01:52:06 GMT)
Full text and
rfc822 format available.
Message #14 received at 21771 <at> debbugs.gnu.org (full text, mbox):
Ivan Andrus wrote:
>> This might be related to bug #2689,
>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=2689
> - :valid-regexp "\\`.\\'"
> + :valid-regexp "\\`\\(.\\|\n\\)\\'"
Note that this reintroduces part of the patch for #2689, which I had to
revert since it caused a worse problem (#3136) than the one it solved.
(I haven't checked whether the same issue applies now to your patch, but
you should.)
Added tag(s) patch.
Request was from
Mauro Aranda <maurooaranda <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 22 Sep 2020 15:44:02 GMT)
Full text and
rfc822 format available.
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 26 Sep 2020 15:11:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 28.1, send any further explanations to
15925 <at> debbugs.gnu.org and Claudio Bley <claudio.bley <at> googlemail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 26 Sep 2020 15:11:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 25 Oct 2020 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 255 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.