[Top][All Lists]

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

Re: [PATCH] `completing-read`: Add `group-function` support to completio

From: Juri Linkov
Subject: Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 4)
Date: Mon, 10 May 2021 23:47:46 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> So what is the plan regarding the patch? Use the variant which has the
> action argument (title, transform, sort) or use the variant with the
> boolean transform argument, which does not allow sorting of the groups?
> Stefan stated in his mail that letting the UI decide if the groups
> should be sorted alphabetically is also a possibility. We can implement
> this proposal by adding a `completions-sort` variable to minibuffer.el,

Probably you meant to name it `completions-group-sort`
since the name `completions-sort` is too ambiguous?

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:

diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 5a7e417b8e..e7b56dd8e0 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -3161,6 +3161,10 @@ read-char-by-name
   (let* ((enable-recursive-minibuffers t)
         (completion-ignore-case t)
         (completion-tab-width 4)
+        (completions-group-sort
+         (if read-char-by-name-group-sort
+             (lambda (a b) (string< (car a) (car b)))
+           completions-group-sort))

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.

reply via email to

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