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#68214: Completion sorting customization by category Date: Sun, 07 Jan 2024 19:37:56 +0100 Message-ID: <87h6jpdm63.fsf@daniel-mendler.de> References: <86a5pnzst1.fsf@mail.linkov.net> <868r5630ft.fsf@mail.linkov.net> <8ebc33fb-d01f-4426-a716-69a11f6dfad1@daniel-mendler.de> <86le95m2ue.fsf@mail.linkov.net> <86sf3cjj6o.fsf@mail.linkov.net> <871qawrxh0.fsf@daniel-mendler.de> <86r0iuxu4f.fsf@mail.linkov.net> <87plye9wbz.fsf@daniel-mendler.de> <86wmslhvdk.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="36593"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 68214@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 07 19:39:16 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 1rMY3H-0009L6-Qi for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Jan 2024 19:39:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMY33-0007br-AN; Sun, 07 Jan 2024 13:39:01 -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 1rMY2z-0007bS-SI for bug-gnu-emacs@gnu.org; Sun, 07 Jan 2024 13:38:58 -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 1rMY2z-0004Lq-JS for bug-gnu-emacs@gnu.org; Sun, 07 Jan 2024 13:38:57 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rMY34-00054s-GJ for bug-gnu-emacs@gnu.org; Sun, 07 Jan 2024 13:39: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: Sun, 07 Jan 2024 18:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68214 X-GNU-PR-Package: emacs Original-Received: via spool by 68214-submit@debbugs.gnu.org id=B68214.170465269719463 (code B ref 68214); Sun, 07 Jan 2024 18:39:02 +0000 Original-Received: (at 68214) by debbugs.gnu.org; 7 Jan 2024 18:38:17 +0000 Original-Received: from localhost ([127.0.0.1]:33831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMY2J-00053p-Iq for submit@debbugs.gnu.org; Sun, 07 Jan 2024 13:38:16 -0500 Original-Received: from server.qxqx.de ([2a01:4f8:121:346::180]:59303 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rMY2F-00053X-04 for 68214@debbugs.gnu.org; Sun, 07 Jan 2024 13:38:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de; s=mail1392553390; 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=WdFFc6B5rFw+8V8KwAJDbEsyAT/qzVQ/eJyJycPtpaw=; b=yBJc/CpLkBFijBLCTkTQmASzr/ T+qP+C4fuw5FXx2oPyTsKSTv9pNHr+DQ61LqK3Q0GKE8KwfETiy55uQP+W49Mbw7McKvROdMMLEI1 Xz61eqsNMV/pxE12vCfn49v15juP8Ih+s8ZxNZbOOTuHqWmNuxhkxNwL1SsTACw6dA8o=; In-Reply-To: <86wmslhvdk.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 07 Jan 2024 20:05:27 +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:277522 Archived-At: Juri Linkov writes: > Thanks for the suggestion. Now pushed in commit 18de131222e, > so all metadata properties are supported now in > `completion-category-overrides'. Thanks. > What do you think about doing the same for > `completion-extra-properties'? Yes, makes sense. The documentation of `completion-extra-properties' would have to be extended accordingly, mentioning all the newly supported properties. It bothers me a little bit that the `completion-metadata-get' lookup wouldn't be allocation-free anymore (because of keywords versus plain symbols), but one could cache the keyword symbol. (defun completion-metadata-get (metadata prop) "Get property PROP from completion METADATA. If the metadata specifies a completion category, the variables `completion-category-overrides' and `completion-category-defaults' take precedence for category-specific overrides. If the completion metadata does not specify the property, the `completion-extra-properties' plist is consulted. Note that the keys of the `completion-extra-properties' plist are keyword symbols, not plain symbols." (if-let (((not (eq prop 'category))) (cat (alist-get 'category metadata)) (over (completion--category-override cat prop))) (cdr over) (or (alist-get prop metadata) (plist-get completion-extra-properties ;; Cache the keyword (or (get prop 'completion-extra-properties--keyword) (put prop 'completion-extra-properties--keyword (intern (concat ":" (symbol-name prop))))))))) Daniel