emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r107117: Fix how the `character' cust


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107117: Fix how the `character' custom type handles space chars.
Date: Sun, 05 Feb 2012 23:33:30 +0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107117
fixes bug(s): http://debbugs.gnu.org/2689
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sun 2012-02-05 23:33:30 +0800
message:
  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.
modified:
  lisp/ChangeLog
  lisp/wid-edit.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-02-05 13:41:50 +0000
+++ b/lisp/ChangeLog    2012-02-05 15:33:30 +0000
@@ -1,3 +1,9 @@
+2012-02-05  Chong Yidong  <address@hidden>
+
+       * wid-edit.el (widget-field-value-get): New optional arg to
+       suppress trailing whitespace truncation.
+       (character): Use it (Bug#2689).
+
 2012-02-05  Andreas Schwab  <address@hidden>
 
        * progmodes/gud.el (gud-pv): Use pv instead of pv1.

=== modified file 'lisp/wid-edit.el'
--- a/lisp/wid-edit.el  2012-01-19 07:21:25 +0000
+++ b/lisp/wid-edit.el  2012-02-05 15:33:30 +0000
@@ -1987,10 +1987,14 @@
     (when (overlayp overlay)
       (delete-overlay overlay))))
 
-(defun widget-field-value-get (widget)
-  "Return current text in editing field."
+(defun widget-field-value-get (widget &optional no-truncate)
+  "Return current text in editing field.
+Normally, trailing spaces within the editing field are truncated.
+But if NO-TRUNCATE is non-nil, include them."
   (let ((from (widget-field-start widget))
-       (to (widget-field-text-end widget))
+       (to   (if no-truncate
+                 (widget-field-end widget)
+               (widget-field-text-end widget)))
        (buffer (widget-field-buffer widget))
        (secret (widget-get widget :secret))
        (old (current-buffer)))
@@ -3407,6 +3411,7 @@
   :format "%{%t%}: %v\n"
   :valid-regexp "\\`.\\'"
   :error "This field should contain a single character"
+  :value-get (lambda (w) (widget-field-value-get w t))
   :value-to-internal (lambda (_widget value)
                       (if (stringp value)
                           value


reply via email to

[Prev in Thread] Current Thread [Next in Thread]