From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] scratch/new-flex-completion-style 2c75775 2/2: Score, sort and annotate flex-style completions according to match tightness Date: Wed, 6 Feb 2019 21:54:45 +0300 Message-ID: <212f7cc9-c0c6-bcf8-f200-ea74db261dc3@yandex.ru> References: <20190202232827.27331.87300@vcs0.savannah.gnu.org> <20190202232828.4AE452159A@vcs0.savannah.gnu.org> <556bfb2e-4720-c86a-c964-f057b50041b6@yandex.ru> <87va1xw7ms.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="25436"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:65.0) Gecko/20100101 Thunderbird/65.0 Cc: emacs-devel@gnu.org To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 06 19:55:02 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1grSLd-0006RB-Sq for ged-emacs-devel@m.gmane.org; Wed, 06 Feb 2019 19:55:02 +0100 Original-Received: from localhost ([127.0.0.1]:57187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grSLc-0001Sr-TP for ged-emacs-devel@m.gmane.org; Wed, 06 Feb 2019 13:55:00 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:55150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grSLW-0001Sh-Oq for emacs-devel@gnu.org; Wed, 06 Feb 2019 13:54:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1grSLV-0001NL-Mw for emacs-devel@gnu.org; Wed, 06 Feb 2019 13:54:54 -0500 Original-Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]:38039) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1grSLV-0001L6-EL for emacs-devel@gnu.org; Wed, 06 Feb 2019 13:54:53 -0500 Original-Received: by mail-lj1-x22f.google.com with SMTP id c19-v6so7053487lja.5 for ; Wed, 06 Feb 2019 10:54:52 -0800 (PST) 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=gE00caBXwjuGcbdKNxz56DnxVJDwS1jT18ElWtLDEh4=; b=KXFZV6G15q+nCPv4QSbAZp2SroFkSrH5RAAEhkwSq3URF+NGR41Bq22xSlT0BRdmTz Yq3oEI4sirJDRReJ7Maw8nDGZBfnto91YshQfYyk94yuiuq9IDycfUyw1cx2BKB/TNZg py4/q65XxyxhePx/fO904TWycrsvxoNTVxW+BimAVe10GljqxRjyEaitryu+pyGpr2We mJM+Lx0QXglh56Avce7am83vLEmFHLg9cW0VTUkxeTCqQeZoBWvPw7udq16ui6rwFeug EZT7yjAvvLSp4fqnyO6LuRby8ETT+S2g93qBvhKWdUWc/TW3i49wcVfkMDQS3J2W/Iw8 h/9g== 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=gE00caBXwjuGcbdKNxz56DnxVJDwS1jT18ElWtLDEh4=; b=PogOXCPuQgq6YOByflR0wjz5b0cLSleLUzFlOboQaOhROwp71blATxZYykK4BioBY4 6+Zk8EyWxCsci7ikUYf/yFCd69SeyC8IhLhVIJYrXUuGvILeBdrJXcDFjH1VssTEMQNs C2+RR/YbhHepIqrPqTw0qlXvfuc0I+2wpZ0u00lNIvNxGnSiFgDgv+96w2Umql04U/+z H+d4kyiwSL+yh7P70wME3uvXyhv4RDP/4oIw6bF6z035jxHs5qG8Xk+ReYuGsjvG01i2 If7vQ3XtBtsjBmk3rsWtYLDiPCMltNAYs20KLm+OisKRX+UFku+Ziy+WpXT7kuxJDUMs FHIw== X-Gm-Message-State: AHQUAuaYE/fVLhN0VWD74WANFbVP6CdOgGOR5z/IYvqjaF/TJg1/pkan QohP+qHpwIsuErMixayqE0RmPi+WEQw= X-Google-Smtp-Source: AHgI3IZy76f9pZd2loW9fiiZk0gCRQgwVZ+Jz3IpQ2Gg8EHxulLAlgezEntn/SD+2b2kXvUgEjC7Mw== X-Received: by 2002:a2e:9595:: with SMTP id w21-v6mr7192887ljh.194.1549479290871; Wed, 06 Feb 2019 10:54:50 -0800 (PST) Original-Received: from [192.168.43.247] ([217.118.78.125]) by smtp.googlemail.com with ESMTPSA id s9-v6sm3868968lja.12.2019.02.06.10.54.47 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 06 Feb 2019 10:54:48 -0800 (PST) In-Reply-To: <87va1xw7ms.fsf@gmail.com> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::22f X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:233058 Archived-At: On 06.02.2019 13:09, João Távora wrote: > Perhaps. But it only does so when the completion style explicitly > wanted it. And even so, the sort order should be stable, i.e. if the > completion style puts numerically equal values in two completions, they > should retain the backend's order. And, obviously, it it doesn't put > any values in that property, then the backend's order is also retained. To put it simply, we already have a way to indicate the completions sorting: provide a particular property, or metadata. I'd prefer not to couple completion style with sorting, because someone somewhere might prefer to go without it (and use some other sorting options, e.g. by frequency of use or mentions in the buffer). > In my experience, at least for the "flex" (also called "scatter", by the > way) completion style, the frontend's sorting takes precedence Not sure what you mean by frontend here. > It is already customizable: you don't have to use "flex" completion > style. Let's first try it out and then see if we need _more_ > customization. I'd rather we start with the "more simply" alternative I've mentioned. But others are welcome to add their opinions. >> Is this for debugging? > > At the moment, yes mostly. But it could not be. In SLY, I give users > an indication of how the scoring algorithm is working. See it in > action: > > https://raw.githubusercontent.com/joaotavora/sly/master/doc/animations/company-flex-completion.gif It's kind of neat, but to be honest I don't see how these percentages help a random user. Even if they do, there's no need to couple this annotation addition to the completion style. Just use a new annotation function that looks up the text properties that the style adds, and adds them on.