Function: custom-guess-type

custom-guess-type is a byte-compiled function defined in cus-edit.el.gz.

Signature

(custom-guess-type SYMBOL)

Documentation

Guess a widget suitable for editing the value of SYMBOL.

This is done by matching SYMBOL with custom-guess-name-alist and if that fails, the doc string with custom-guess-doc-alist.

Source Code

;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
(defun custom-guess-type (symbol)
  "Guess a widget suitable for editing the value of SYMBOL.
This is done by matching SYMBOL with `custom-guess-name-alist' and
if that fails, the doc string with `custom-guess-doc-alist'."
  (let ((name (symbol-name symbol))
	(names custom-guess-name-alist)
	current found)
    (while names
      (setq current (car names)
	    names (cdr names))
      (when (string-match-p (nth 0 current) name)
	(setq found (nth 1 current)
	      names nil)))
    (unless found
      (let ((doc (documentation-property symbol 'variable-documentation t))
	    (docs custom-guess-doc-alist))
	(when doc
	  (while docs
	    (setq current (car docs)
		  docs (cdr docs))
	    (when (string-match-p (nth 0 current) doc)
	      (setq found (nth 1 current)
		    docs nil))))))
    found))