bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#48545: 28.0.50; `icomplete-vertical-mode` does not support the `grou


From: Dmitry Gutov
Subject: bug#48545: 28.0.50; `icomplete-vertical-mode` does not support the `group-function`
Date: Thu, 19 Aug 2021 18:02:57 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 19.08.2021 14:18, João Távora wrote:
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.

We discussed this problem when group-function was introduced. Another approach is to just change the method of grouping: first the completions are sorted, and then they are sorted into groups.

The group that goes first is the group to which the first completion in the sorted list belongs to. It doesn't matter whether some of the subsequent items in it are sorted at the end of the list: as long as they return the same value for "group", they get put into that first group.

I wonder which strategy Daniel ultimately chose to use in Consult. Perhaps we should document it in the API, so that the implementations stay consistent.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]