Function: custom-variable-documentation

custom-variable-documentation is a byte-compiled function defined in cus-edit.el.gz.

Signature

(custom-variable-documentation VARIABLE)

Documentation

Return documentation of VARIABLE for use in Custom buffer.

Normally just return the docstring. But if VARIABLE automatically becomes buffer local when set, append a message to that effect. Also append any obsolescence information.

Source Code

;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
(defun custom-variable-documentation (variable)
  "Return documentation of VARIABLE for use in Custom buffer.
Normally just return the docstring.  But if VARIABLE automatically
becomes buffer local when set, append a message to that effect.
Also append any obsolescence information."
  (format "%s%s%s" (documentation-property variable 'variable-documentation t)
	  (if (and (local-variable-if-set-p variable)
		   (or (not (local-variable-p variable))
		       (with-temp-buffer
			 (local-variable-if-set-p variable))))
	      "\n
This variable automatically becomes buffer-local when set outside Custom.
However, setting it through Custom sets the default value."
	    "")
	  ;; This duplicates some code from describe-variable.
	  ;; TODO extract to separate utility function?
	  (let* ((obsolete (get variable 'byte-obsolete-variable))
		 (use (car obsolete)))
	    (if obsolete
		(concat "\n
This variable is obsolete"
			(if (nth 2 obsolete)
			    (format " since %s" (nth 2 obsolete)))
			(cond ((stringp use) (concat ";\n" use))
			      (use (format-message ";\nuse `%s' instead."
						   (car obsolete)))
			      (t ".")))
	      ""))))