emacs-devel
[Top][All Lists]
Advanced

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

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


From: Daniel Mendler
Subject: Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 4)
Date: Sat, 8 May 2021 10:45:24 +0200

On 5/8/21 8:24 AM, Daniel Mendler wrote:
> On 5/7/21 7:55 PM, Daniel Mendler wrote:
>> On 5/7/21 7:03 PM, Juri Linkov wrote:
>>> I tried to remove `read-char-by-name-group`, but it has a feature
>>> currently not supported by `group-function`:
>>>
>>>   (defcustom read-char-by-name-group nil
>>>     "How to group characters for `read-char-by-name' completion.
>>>   When t, split characters to sections of Unicode blocks
>>>   sorted alphabetically."
>>>   =====================
>>>
>>> It seems a new function is needed to sort groups, e.g. 
>>> `group-sort-function`.
>
> 3. Use a single function with an action argument
>    3.1 group-function : (action=title) -> string -> string
>    3.2 group-function : (action=transform) -> string -> string
>    3.3 group-function : (action=sort) -> list string -> list string
I attached the current set of patches. The last patch
"0005-group-function-Implement-generalized-action-argument.patch"
implements the generalized action argument. The other patches (1-4) do
not differ from the previously sent patches. I send them for completeness.

Given the lastest patch, the `group-function` works as follows:

(group-function 'title cand) --> returns group title
(group-function 'transform cand) --> returns transformed candidate
(group-function 'sort groups) --> returns sorted alist of groups

The modification is quite minimal over the previous version with the
boolean transform argument. For completion tables which only want to
provide group titles, the group function definition is equally simple as
before:

(defun some-group-function (action arg)
  (if (eq action 'title)
      (get-title arg)
    arg))

Daniel

Attachment: 0001-completing-read-Add-group-function-to-completion-met.patch
Description: Text Data

Attachment: 0002-completion-insert-strings-Split-function-Full-group-.patch
Description: Text Data

Attachment: 0003-minibuffer-completion-help-Do-not-check-completions-.patch
Description: Text Data

Attachment: 0004-completion-insert-vertical-Separate-groups-completel.patch
Description: Text Data

Attachment: 0005-group-function-Implement-generalized-action-argument.patch
Description: Text Data


reply via email to

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