GNU bug report logs - #74865
[PATCH] Use `completion-table-with-metadata'

Previous Next

Package: emacs;

Reported by: Daniel Mendler <mail <at> daniel-mendler.de>

Date: Sat, 14 Dec 2024 12:58:02 UTC

Severity: normal

Tags: patch

Fixed in version 31.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #22 received at 74865 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Mendler <mail <at> daniel-mendler.de>
To: Juri Linkov <juri <at> linkov.net>
Cc: 74865 <at> debbugs.gnu.org
Subject: Re: bug#74865: [PATCH] Use `completion-table-with-metadata'
Date: Mon, 16 Dec 2024 20:26:45 +0100
Juri Linkov <juri <at> linkov.net> writes:

>>> Also it could be used in `read-char-by-name' as well.
>>
>> Yes, there are certainly more use cases. I didn't use it for
>> `read-char-by-name' since this would change the caching behavior
>> slightly. The character names would be loaded a little bit earlier,
>> which would slow down the initialization of `read-char-by-name'.
>
> Maybe the caching behavior could be preserved by turning
> `completion-table-with-metadata' into a macro?

Let us please keep `completion-table-with-metadata' a function for
composeability and ease of reasoning. `completion-table-with-metadata'
follows the many already existing `completion-table-with-*' functions in
minibuffer.el.

In order to delay initialization of the completion candidates we can use
the following code:

(completion-table-with-metadata
 (lambda (string pred action)
   (complete-with-action action (ucs-names) string pred))
 metadata)

(completion-table-with-metadata
 (completion-table-dynamic (lambda (_) (ucs-names)))
 metadata)

>>> Maybe `completion-table-with-metadata' should be announced
>>> in the "Lisp Changes" section of etc/NEWS?
>>
>> Yes, please go ahead adding it to the NEWS. I will backport the function
>> also via Compat.
>
> Ok, now added to NEWS.

Thanks.

Daniel




This bug report was last modified 164 days ago.

Previous Next


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