Function: widget-field-value-get

widget-field-value-get is a byte-compiled function defined in wid-edit.el.gz.

Signature

(widget-field-value-get WIDGET &optional NO-TRUNCATE)

Documentation

Return current text in editing field.

Normally, trailing spaces within the editing field are truncated. But if NO-TRUNCATE is non-nil, include them.

Source Code

;; Defined in /usr/src/emacs/lisp/wid-edit.el.gz
(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   (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)))
    (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))))