GNU bug report logs - #74718
29.4; Huge metadata with flex completion style

Previous Next

Package: emacs;

Reported by: Thierry Volpiatto <thievol <at> posteo.net>

Date: Sat, 7 Dec 2024 08:01:01 UTC

Severity: normal

Found in version 29.4

Full log


View this message in rfc822 format

From: Thierry Volpiatto <thievol <at> posteo.net>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: Thierry Volpiatto <thievol <at> posteo.net>, 74718 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: bug#74718: 29.4; Huge metadata with flex completion style
Date: Tue, 10 Dec 2024 06:25:44 +0000
[Message part 1 (text/plain, inline)]
Hi Dmitry,

Dmitry Gutov <dmitry <at> 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
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 187 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.