Function: widget-default-value-set
widget-default-value-set is a byte-compiled function defined in
wid-edit.el.gz.
Signature
(widget-default-value-set WIDGET VALUE)
Documentation
Recreate widget with new value.
Source Code
;; Defined in /usr/src/emacs/lisp/wid-edit.el.gz
(defun widget-default-value-set (widget value)
"Recreate widget with new value."
(let* ((old-pos (point))
(from (copy-marker (widget-get widget :from)))
(to (copy-marker (widget-get widget :to)))
(offset (if (and (<= from old-pos) (<= old-pos to))
(if (>= old-pos (1- to))
(- old-pos to 1)
(- old-pos from)))))
;;??? Bug: this ought to insert the new value before deleting the old one,
;; so that markers on either side of the value automatically
;; stay on the same side. -- rms.
(save-excursion
(goto-char (widget-get widget :from))
(widget-apply widget :delete)
(widget-put widget :value value)
(widget-apply widget :create))
(if offset
(goto-char (if (< offset 0)
(+ (widget-get widget :to) offset 1)
(min (+ from offset) (1- (widget-get widget :to))))))))