aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2012-02-05 23:33:30 +0800
committerChong Yidong2012-02-05 23:33:30 +0800
commitaa4589a7cfb435c704549855b1f19e335bcf3b20 (patch)
tree40d2bbd3e9e53bec54b753ace5eaa6cdc507ac90
parente1161b06fc12499f9990fc23a915d75bb8866cd2 (diff)
downloademacs-aa4589a7cfb435c704549855b1f19e335bcf3b20.tar.gz
emacs-aa4589a7cfb435c704549855b1f19e335bcf3b20.zip
Fix how the `character' custom type handles space chars.
* lisp/wid-edit.el (widget-field-value-get): New optional arg to suppress trailing whitespace truncation. (character): Use it. Fixes: debbugs:2689
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/wid-edit.el11
2 files changed, 14 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6a31a20f947..93dd50b5ecb 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12012-02-05 Chong Yidong <cyd@gnu.org>
2
3 * wid-edit.el (widget-field-value-get): New optional arg to
4 suppress trailing whitespace truncation.
5 (character): Use it (Bug#2689).
6
12012-02-05 Andreas Schwab <schwab@linux-m68k.org> 72012-02-05 Andreas Schwab <schwab@linux-m68k.org>
2 8
3 * progmodes/gud.el (gud-pv): Use pv instead of pv1. 9 * progmodes/gud.el (gud-pv): Use pv instead of pv1.
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 27922327f44..61bb4db558c 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -1987,10 +1987,14 @@ the earlier input."
1987 (when (overlayp overlay) 1987 (when (overlayp overlay)
1988 (delete-overlay overlay)))) 1988 (delete-overlay overlay))))
1989 1989
1990(defun widget-field-value-get (widget) 1990(defun widget-field-value-get (widget &optional no-truncate)
1991 "Return current text in editing field." 1991 "Return current text in editing field.
1992Normally, trailing spaces within the editing field are truncated.
1993But if NO-TRUNCATE is non-nil, include them."
1992 (let ((from (widget-field-start widget)) 1994 (let ((from (widget-field-start widget))
1993 (to (widget-field-text-end widget)) 1995 (to (if no-truncate
1996 (widget-field-end widget)
1997 (widget-field-text-end widget)))
1994 (buffer (widget-field-buffer widget)) 1998 (buffer (widget-field-buffer widget))
1995 (secret (widget-get widget :secret)) 1999 (secret (widget-get widget :secret))
1996 (old (current-buffer))) 2000 (old (current-buffer)))
@@ -3407,6 +3411,7 @@ To use this type, you must define :match or :match-alternatives."
3407 :format "%{%t%}: %v\n" 3411 :format "%{%t%}: %v\n"
3408 :valid-regexp "\\`.\\'" 3412 :valid-regexp "\\`.\\'"
3409 :error "This field should contain a single character" 3413 :error "This field should contain a single character"
3414 :value-get (lambda (w) (widget-field-value-get w t))
3410 :value-to-internal (lambda (_widget value) 3415 :value-to-internal (lambda (_widget value)
3411 (if (stringp value) 3416 (if (stringp value)
3412 value 3417 value