From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs,gmane.emacs.devel Subject: bug#47711: bug#48841: [PATCH] Add new `completion-filter-completions` API and deferred highlighting Date: Sat, 14 Aug 2021 06:11:26 +0300 Message-ID: <5dba40c7-681b-392d-486a-ae71090d27f4@yandex.ru> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28163"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 Cc: 47711@debbugs.gnu.org, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , 48841@debbugs.gnu.org, Stefan Monnier To: Daniel Mendler , "emacs-devel@gnu.org" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 14 05:12:15 2021 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 1mEk5k-00079O-Q2 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 14 Aug 2021 05:12:12 +0200 Original-Received: from localhost ([::1]:58396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mEk5j-0002PJ-DJ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Aug 2021 23:12:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEk5a-0002Lc-Nj for bug-gnu-emacs@gnu.org; Fri, 13 Aug 2021 23:12:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60079) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mEk5a-0008ML-Gw for bug-gnu-emacs@gnu.org; Fri, 13 Aug 2021 23:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mEk5a-0005zN-6c for bug-gnu-emacs@gnu.org; Fri, 13 Aug 2021 23:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Aug 2021 03:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47711 X-GNU-PR-Package: emacs Original-Received: via spool by 47711-submit@debbugs.gnu.org id=B47711.162891069622989 (code B ref 47711); Sat, 14 Aug 2021 03:12:02 +0000 Original-Received: (at 47711) by debbugs.gnu.org; 14 Aug 2021 03:11:36 +0000 Original-Received: from localhost ([127.0.0.1]:43392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mEk5A-0005ye-Bl for submit@debbugs.gnu.org; Fri, 13 Aug 2021 23:11:36 -0400 Original-Received: from mail-wr1-f48.google.com ([209.85.221.48]:40583) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mEk58-0005yJ-2K; Fri, 13 Aug 2021 23:11:34 -0400 Original-Received: by mail-wr1-f48.google.com with SMTP id k29so15760049wrd.7; Fri, 13 Aug 2021 20:11:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=8qJF3v8JbwJAZ15jhDdtLSeHlHSTougNt1Um+Emevgs=; b=uhb3Yu2G/KwF7e23ESrN4j/Fh07Y51CsdrtrHwzY2W3mXnf2hTJ+nyFKDVb1cB09t0 utWlFJEmCtPOi1lSSISjfuadcx1seTUW8FNXGAaXP5GYHuCrgxhEkyoeckULXB6hYw1d hcMvXWlpglvE1U6x6dBxhqqoIqspz8DoK5OFzxfkWH+VOFzUb6sncRrvYWMd8FcL3riD LYupotBinwmXxXkps3k3UKa+IArjNeeQ2/uLlBOSckA5X0FT+wanYvp8tuwcWDbT4VW9 Php/VN8Fu0s0SkbB3WNC4779V6VFZgYoovzxA2+33u//UtCPTPUdPX4iszORMtaq10TC tZrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=8qJF3v8JbwJAZ15jhDdtLSeHlHSTougNt1Um+Emevgs=; b=WQ1H4EbH4EBesGEw0wHtd400mwrs92osOVMjjQS6bKOq1DgBNSZ1KkttUCw5401CLQ W2sTz3+tIB4ClHZw3QIM0lOgleBfPRJZ17yei489eI/448D/YnGgO0Y6HP6Paf7IJ6M6 Lboe/kXXMTljbtRK+JZxXA1PSil9uyzBqkb3JW8v+rIT5zkBLXuNNQBgDZx25U02BJ/u AMWT+SPigIwEnyx+XJ1o4F5utwEQMZNt0PIFtiqn6OLArZv/0cGwPwpDqw3O1hqtCYby 55S8SrGaju4iC2mjMmWQJqEdJE79D7Ty+UfdacCoq9/4WH5H7GJA+8/8e1vlSIgL+GUl OVyg== X-Gm-Message-State: AOAM530YfUQaXZJZVwpeDnHEmo8GDF4SVgH5Gk3XV9KcnbXOKmbabtL2 sVBNDKeYQ//8MXSUpsICGxxQgiUBchc= X-Google-Smtp-Source: ABdhPJxsO782oJW6/wOSeAg58zlmFyQfHKUIV+YHUBe0p3NUhjFYEMpSgTKZfhOE8W+l2fTU/YsL6Q== X-Received: by 2002:a5d:42c2:: with SMTP id t2mr6137986wrr.49.1628910688214; Fri, 13 Aug 2021 20:11:28 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id z126sm3235705wmc.11.2021.08.13.20.11.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Aug 2021 20:11:27 -0700 (PDT) In-Reply-To: Content-Language: en-US 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" Xref: news.gmane.io gmane.emacs.bugs:211801 gmane.emacs.devel:272375 Archived-At: Hi Daniel, I haven't yet read the patch in detail, but it sounds like a move in the right direction (even if it doesn't include the long-overdue overhaul of the whole API). A few notes on the new stuff: > Finally the `highlight` value is a function taking a list of completion strings and returns a new list of new strings with highlighting applied. First of all, I'd really like it to be a function that applies to individual completion strings, not the whole collection. That would make it much easier to use in company-capf without having to rewrite a lot of code in the presentation layer. Second, perhaps instead of modifying the strings themselves it could return some data (like a list of faces-intervals tuples) that could be used to do so? Again, in company-capf's we end up parsing the face properties in the string, so those modifications are just extra work for CPU which we could eliminate. This is less critical, though. On 11.08.2021 19:11, Daniel Mendler wrote: > There are currently two issues with the patch with regards to backward > compatibility. Fortunately they are fixable with a little effort. > > 1. I would like to deprecate `completion-score' or remove it altogether, > but unfortunately `completion-score' is used in the wild. In order to > preserve `completion-score', bind `completion--filter-completions' in > the highlighting functions. Add `completion-score' in > `completion-pcm--hilit-commonality' when > `completion--filter-completions' is nil. And third: I think completion-score could ultimately use the same treatment as 'highlight'. Meaning, being returned up the stack together with completions, so other bits of code could look up those values. I don't have a clear picture of this yet, but see the recently filed bug#49888. If we want to be able to combine matching scores with recency scores, simply sorting the completions after matching is not going to cut it. Not sure if this is something we can tackle now, but keeping this possible evolution in mind could help us make good choices in the current migration.