[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 11:10:59 +0200 |
On 5/8/21 10:45 AM, Daniel Mendler wrote:
> 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.
Correction to the lastest patch. The `minibuffer--group-by` function
should actually be written as follows:
(defun minibuffer--group-by (group-fun elems)
"Group ELEMS by GROUP-FUN."
(let ((groups))
(dolist (cand elems)
(let* ((key (funcall group-fun 'title cand))
(group (assoc key groups)))
(if group
(setcdr group (cons cand (cdr group)))
(push (list key cand) groups))))
;; FIXME: Is thread-last allowed in minibuffer.el?
(setq groups (nreverse groups)
groups (mapc (lambda (x)
(setcdr x (nreverse (cdr x))))
groups)
groups (funcall group-fun 'sort groups)
groups (mapcar #'cdr groups))
(apply #'nconc groups)))
Daniel
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 2), Juri Linkov, 2021/05/01
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 2), Daniel Mendler, 2021/05/01
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 2), Juri Linkov, 2021/05/02
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 2), Juri Linkov, 2021/05/07
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 2), Daniel Mendler, 2021/05/07
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 2), Daniel Mendler, 2021/05/08
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 4), Daniel Mendler, 2021/05/08
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 4),
Daniel Mendler <=
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 4), Juri Linkov, 2021/05/09
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 4), Daniel Mendler, 2021/05/09
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 4), Stefan Monnier, 2021/05/09
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 4), Daniel Mendler, 2021/05/09
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 4), Juri Linkov, 2021/05/10
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 5), Daniel Mendler, 2021/05/11
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 5), Juri Linkov, 2021/05/11
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 2), Stefan Monnier, 2021/05/08
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 2), Juri Linkov, 2021/05/09
- Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata (REVISED PATCH VERSION 2), Eli Zaretskii, 2021/05/09