I noticed a quirk, though. If I add '-l etags' to the 'emacs -Q' line,
one gets 6 matches instead of 5 (due to etags having another
xref-location-marker). That's fine, but due to the default
alphanumeric/length sorting, it gets shoved into the group of xref.el
matches and thus we get two xref.el groups. I.e. it looks like
xref.el
(cl-defgeneric xref-location-marker)
(cl-defmethod xref-location-marker ((l xref-file-location)))
(cl-defmethod xref-location-marker ((l xref-bogus-location)))
etags.el
(cl-defmethod xref-location-marker ((l xref-etags-location)))
xref.el
(cl-defmethod xref-location-marker ((l xref-buffer-location)))
elisp-mode.el
(cl-defmethod xref-location-marker ((l xref-elisp-location)))
I don't use completions-group so I don't care strongly for this, but I
believe that this is generally undesired, for non-filtering scenarios.
All the entries from the xref.el group should probably be clumped
together. If a user were flex-matching and thus expecting certain sort
score-based order, it_would_ make sense to me, but here no flexy things
were happening at all.
To fix this, perhaps the default sorting methods should be turned off in
completion-all-sorted-completions in minibuffer.el if a table supplies
`group-function`. A patch for this is after my sig.