Function: custom-add-parent-links

custom-add-parent-links is a byte-compiled function defined in cus-edit.el.gz.

Signature

(custom-add-parent-links WIDGET &optional INITIAL-STRING DOC-INITIAL-STRING)

Documentation

Add "Parent groups: ..." to WIDGET if the group has parents.

The value is non-nil if any parents were found. If INITIAL-STRING is non-nil, use that rather than "Parent groups:".

Source Code

;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
(defun custom-add-parent-links (widget &optional initial-string _doc-initial-string)
  "Add \"Parent groups: ...\" to WIDGET if the group has parents.
The value is non-nil if any parents were found.
If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"."
  (let ((name (widget-value widget))
	(type (widget-type widget))
	(buttons (widget-get widget :buttons))
	(start (point))
	(parents nil))
    (insert (or initial-string "Groups:"))
    (mapatoms (lambda (symbol)
		(when (member (list name type) (get symbol 'custom-group))
		  (insert " ")
		  (push (widget-create-child-and-convert
			 widget 'custom-group-link
			 :tag (custom-unlispify-tag-name symbol)
			 symbol)
			buttons)
		  (setq parents (cons symbol parents)))))
    (if parents
        (insert "\n")
      (delete-region start (point)))
    (widget-put widget :buttons buttons)
    parents))