From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74865: [PATCH] Use `completion-table-with-metadata' Date: Mon, 16 Dec 2024 20:26:45 +0100 Message-ID: <87ttb3pgy2.fsf@daniel-mendler.de> References: <87o71eifrs.fsf@daniel-mendler.de> <874j33ebhh.fsf@mail.linkov.net> <87seqnh47j.fsf@daniel-mendler.de> <87pllrcuga.fsf@mail.linkov.net> Reply-To: Daniel Mendler Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30753"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 74865@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 16 20:27:34 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tNGkg-0007jQ-OT for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Dec 2024 20:27:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNGkV-00067o-MA; Mon, 16 Dec 2024 14:27:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNGkB-00062z-7i for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2024 14:27:04 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNGkA-0004t2-O6 for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2024 14:27:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=YUPR3nHk1virp9THvu/14WDrpCBNnPadV0gQJy2F20Y=; b=Rt5pJOVOsGMYbLxnWu0qK1p9b3oNwnKNTP2RO0FMTyiqNuxqNrUCB/ujYqLAnus/ddiEKhdSIy0P/VsGV+33jhCIm2zwbXEkm6+3WZE98py72NRJEJEarAkbrATzz0N+BQhcZ/LleTSZ6Y7J4ZPG3pnqU/MEs9ZVqkP3T+11DzjzmKhjRtKPr7EHMIPe6ShS0WGzkxxDcSKL0AcgoweQlL5G8QYJyWlZRmb9cbaVstEj9YWdeEQSOy5e+fd0W2baloCmZaoV5uNYgqWm1gZK25OCDmf+wlFNITo1z7jBD5y9xRP/duNxOUDRyaEfQPfiMSrGRwl7Qy+pDOSRm11dmw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tNGkA-0004Xr-BV for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2024 14:27:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Dec 2024 19:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74865 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74865-submit@debbugs.gnu.org id=B74865.173437721617450 (code B ref 74865); Mon, 16 Dec 2024 19:27:02 +0000 Original-Received: (at 74865) by debbugs.gnu.org; 16 Dec 2024 19:26:56 +0000 Original-Received: from localhost ([127.0.0.1]:56272 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tNGk4-0004XO-Dy for submit@debbugs.gnu.org; Mon, 16 Dec 2024 14:26:56 -0500 Original-Received: from server.qxqx.de ([49.12.34.165]:59009 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tNGk1-0004Ws-6W for 74865@debbugs.gnu.org; Mon, 16 Dec 2024 14:26:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YUPR3nHk1virp9THvu/14WDrpCBNnPadV0gQJy2F20Y=; b=R7i5TNpeD+7x8nb0AQYWOZUUNE oEuK91ULnwOgtssYc6UT3cNfmDj4PymoGSWh57fvLaNud6Cbb/DoLqB7iMZ+f05US47yLmp75SxSZ NZt6MEOJvIVTRH6wz0CXbS1aBssXhs7ZTIutH8W3iGXzTbAO5HPNtYWYNHMehjHtuQJM=; In-Reply-To: <87pllrcuga.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 16 Dec 2024 21:13:25 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:297219 Archived-At: Juri Linkov 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