On 5/10/21 10:47 PM, Juri Linkov wrote: > Probably you meant to name it `completions-group-sort` > since the name `completions-sort` is too ambiguous? Yes, I meant to add a `completions-group-sort(-function)` customizable variable. I attached the updated patch set, where the last patch "0005-minibuffer-completion-help-Add-group-sorting.patch" adds the `completions-group-sort-function` variable. (The behavior is equivalent to the previous patch set where the `group-function` has a generalized action argument.) > Then such an option could support any function to perform sorting, > and when necessary the API user could let-bind it around > the API call, e.g. in the case of the ucs-char-names:> ... > This is just an example, I'm not sure if read-char-by-name-group-sort is > really needed, but this example demonstrates that it's up to the user to > define options more specific to the completion table. Of course, a completion command can let-bind/override certain dynamically bound variables which influence the behavior of the completion UI. However there are two downsides to be noted: 1. By doing such an override the ability of the user to configure the completion UI is subverted. 2. Since the variables are let-bound, they influence the behavior of nested recursive completion sessions. It is better to override the variables with `setq-local` in a `minibuffer-setup-hook`. Daniel