bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#74718: 29.4; Huge metadata with flex completion style


From: Thierry Volpiatto
Subject: bug#74718: 29.4; Huge metadata with flex completion style
Date: Tue, 10 Dec 2024 06:25:44 +0000

Hi Dmitry,

Dmitry Gutov <dmitry@gutov.dev> writes:

> Can you also reproduce it without Helm?

Here a small recipe you can play with:

From emacs -Q:

1) Open some buffers
2) eval this in scratch:

(setq completion-styles '(flex))
(let* ((collection (mapcar #'buffer-name (buffer-list)))
       (metadata (completion-metadata "" collection nil))
       (completion-function (lambda (str _pred _action)
                              (let* ((comps (completion-all-completions str 
collection nil (length str) metadata))
                                     (sort-fn (completion-metadata-get metadata 
'display-sort-function))
                                     (last (last comps)))
                                (when (cdr last)
                                  (setcdr last nil))
                                (message "%S" metadata)
                                (if (and sort-fn (> (length str) 0)) (funcall 
sort-fn comps) comps)))))
  (completing-read "test: " completion-function))

Try to complete with some flex patterns e.g. "hlm" for "helm" and
consult *messages* buffer.

-- 
Thierry

Attachment: signature.asc
Description: PGP signature


reply via email to

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