[Top][All Lists]

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

Re: Possible minibuffer completion enhancements

From: Daniel Mendler
Subject: Re: Possible minibuffer completion enhancements
Date: Mon, 22 Jan 2024 09:12:19 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Juri Linkov <juri@linkov.net> writes:

>> I've rebased the feature/minibuffer-completion-enhancements branch on
>> top of the current master, and pushed it to emacs.git.  Looking forward
>> for your thoughts and feedback!
> Thanks, I tried 'C-x C-v' (minibuffer-sort-completions),
> and it works nicely.  But I can't imagine how the whole
> branch could be merged to master when it contains
> so diverse set of different features.

I agree. I suggest to create a set of separate patches, e.g., as

1. Helper functions, e.g., completion-table-with-metadata
2. CRM refactoring
3. Cycle commands for sorting
4. Cycle commands for completion styles
5. Annotation functions
6. Narrowing commands

Regarding 5 and 6 it would be great to explore an alternative approach
with a :property-function because of the additional flexibility and
extensibility. We would get a lot of functionality for free.

Iirc Stefan Monnier had plans to change the implementation of the
completion machinery, rebasing it on a cl-defgeneric mechanism, where
completion tables provide cl-defmethods. If more and more additional
completion candidate metadata is supplied, looking into this again may
be worthwhile.

> For example, probably everyone would agree that
> 'completion-table-with-metadata' could be installed
> in master immediately (if you present a separate patch).
> But other feature might require more discussion.

Indeed. However the implementation of completion-table-with-metadata
I've seen in Eshel's branch did not seem correct. The function should be

(defun completion-table-with-metadata (table metadata)
  (lambda (str pred action)
    (if (eq action 'metadata)
        `(metadata ,@metadata
                   ,@(and (functionp table)
                          (cdr (funcall table str pred action))))
      (complete-with-action action table str pred))))


reply via email to

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