help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Customize: Space char in `character' specification


From: martin rudalics
Subject: Re: Customize: Space char in `character' specification
Date: Sun, 21 May 2006 12:23:01 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Try the attached patch.

martin
*** wid-edit.el Tue Apr 11 16:23:54 2006
--- wid-edit.el Sun May 21 12:18:38 2006
***************
*** 3380,3385 ****
--- 3380,3386 ----
    :value 0
    :size 1
    :format "%{%t%}: %v\n"
+   :value-get 'widget-character-value-get
    :valid-regexp "\\`.\\'"
    :error "This field should contain a single character"
    :value-to-internal (lambda (widget value)
***************
*** 3393,3398 ****
--- 3394,3395 ----
    :match (lambda (widget value)
           (char-valid-p value)))

+ (defun widget-character-value-get (widget)
+   "Return character value."
+   (let ((from (widget-field-start widget))
+       (to (widget-field-end widget))
+       (buffer (widget-field-buffer widget))
+       (secret (widget-get widget :secret))
+       (old (current-buffer)))
+     (if (and from to)
+       (progn
+         (set-buffer buffer)
+         (let ((result (buffer-substring-no-properties from to)))
+           (when secret
+             (let ((index 0))
+               (while (< (+ from index) to)
+                 (aset result index
+                       (get-char-property (+ from index) 'secret))
+                 (setq index (1+ index)))))
+           (set-buffer old)
+           result))
+       (widget-get widget :value))))
+ 
  (define-widget 'list 'group
    "A Lisp list."
    :tag "List"

reply via email to

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