custom-sort-items

custom-sort-items is a compiled Lisp function in `cus-edit.el'.

(custom-sort-items ITEMS SORT-ALPHABETICALLY ORDER-GROUPS)

Return a sorted copy of ITEMS.
ITEMS should be a list of `custom-group' properties.
If SORT-ALPHABETICALLY non-nil, sort alphabetically.
If ORDER-GROUPS is `first' order groups before non-groups, if `last' order
groups after non-groups, if nil do not order groups at all.