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

From: Thierry Volpiatto <[email-masked]>
Date: Tue, 10 Dec 2024 06:25:44 +0000

Hi Dmitry,

Dmitry Gutov <[email-masked]> 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