From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?iso-8859-1?Q?Jo=E3o_T=E1vora?= 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: Tue, 12 Feb 2019 17:21:13 +0000 Message-ID: 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> <212f7cc9-c0c6-bcf8-f200-ea74db261dc3@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="107266"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt) Cc: emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 12 18:21:51 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 1gtbkl-000RnS-Kw for ged-emacs-devel@m.gmane.org; Tue, 12 Feb 2019 18:21:51 +0100 Original-Received: from localhost ([127.0.0.1]:43141 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtbkk-0004By-BZ for ged-emacs-devel@m.gmane.org; Tue, 12 Feb 2019 12:21:50 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtbkU-0004Ao-Ft for emacs-devel@gnu.org; Tue, 12 Feb 2019 12:21:37 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtbkS-0002Vo-D1 for emacs-devel@gnu.org; Tue, 12 Feb 2019 12:21:34 -0500 Original-Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:51752) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gtbkM-00025T-Qz for emacs-devel@gnu.org; Tue, 12 Feb 2019 12:21:28 -0500 Original-Received: by mail-wm1-x329.google.com with SMTP id b11so3884911wmj.1 for ; Tue, 12 Feb 2019 09:21:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=Y/UlQA3jfFOs++DTs111PAifsWduemEortheJubDcyA=; b=t5pwErHCC0OgXW/tj8wNkhilHJcd0WEVT9EwFocKH/4jlvF5FtiPCCvBZiC1uLpo5k cj4b3/dw5ubcfZUIycDdakmdxcoxhjleXjsJt1pFXUJ3rxw8sn5OWPK7rrzFvs14m1ru fTfW37OHyQyBDY3VV4Bx5DFmwyf4Yw2bK3Ks3LSXrwijW6RnbHtF6+PJJ1qXSdW48t74 3tbIdoYcq9r5Y7O1i8FYTzYi8FqV/hHRFTO7rwbxnqlmNRMt3BPaRY9AMOHEzfA9Z9mN Z1ra1WPhl4Sj9xkhvm5HcyyLK7CxCki+khfnVd2q0rbwSdV0bNBgbQ2ir+pj8+h9CgoI 5Iow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=Y/UlQA3jfFOs++DTs111PAifsWduemEortheJubDcyA=; b=YpmvmxpG9FtDGsi15MrCtmeyzxDdiBpmhjOZqR3IBJ16UmmWR988/digCfHJoOZmrS CYGBRB7sjWV89kZb0jnXXZIgeYrv4/fGVJGqbUt4b+rPqkgPFKCAmAa289obqetOUyBx dvd2wjb/pLf5U0FbfYYj0UzYCLItZNLpvAdlxZs+ocrKZDgHYhqSB5GBn634xwH9RWln pf3CQ2CSQJ1y83hF+xw2R6IwO9Sq091Wl1bIdES9+PiU78pz+Jh35S7gIvb6J5dcsZKp u2zfgmCsQIGhXLfBVGCMBLH2/eSBak84eUnn6sh/E0dKEN5kpldcBV+IOkI3Em+zUGsc TAlA== X-Gm-Message-State: AHQUAuYCpR63FJMYFcTug0329GNhk4jI1CZ4amejp0Vx4gBYlTyj3Cfw bl4pzTmtVY3GXQFZSfe2nrEemhIT X-Google-Smtp-Source: AHgI3IZe+6uXtXukPPyNg7uchLBB5aE9saEO5NXLeeqk8L0uuOxCO7Beu9h1gVbSnHqNpnIjZcyYkw== X-Received: by 2002:a7b:c764:: with SMTP id x4mr3566605wmk.47.1549992076058; Tue, 12 Feb 2019 09:21:16 -0800 (PST) Original-Received: from GONDOMAR.yourcompany.com (mail3.siscog.pt. [195.23.29.18]) by smtp.gmail.com with ESMTPSA id d4sm2744829wmb.25.2019.02.12.09.21.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Feb 2019 09:21:15 -0800 (PST) In-Reply-To: (Dmitry Gutov's message of "Tue, 12 Feb 2019 03:25:24 +0300") X-Antivirus: AVG (VPS 190212-2, 12-02-2019), Outbound message X-Antivirus-Status: Clean X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 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:233258 Archived-At: Dmitry Gutov writes: > Consequently, a preexisting completion tables wouldn't be > supported. But like I said, it shouldn't be hard to change either. Oh. That's what I feared (I think) It would be nice to add something seemingly orthogonal like a "completion style" to all completion UI's and all tables, without needing to change the completion tables (granted, it would be good to *also* not change the UI's, but I'm not sure there a solution for that). > I dunno, sorting takes CPU time anyways. Not sure a combination of > several sorting functions will frequently give a better result than > just one of them. I dunno what you dunno. When using flex/scatter it's *really* important to sort by flex-match. I suggested "stable sorting" because it's a slightly more decent thing to completion tables. And by sorting twice it's not like we're changing the Big-O complexity or anything. But I also don't mind a scheme where the style's sorting completely takes over (and we save those CPU cycles). > But then, if you enable company-sort-by-occurrence via > company-transformers, the completion style's sorting won't be visible > anymore anyway. I don't know what company-transformers are. On the one hand I suppose when you want to sort by occurance, you ... want to sort by occurrence. So if you use the symbol "foofooubarbarnbazbazdquuxquuxo" very often you'll see it sort to the top for your "undo" example. So maybe company should take the style's sorting last here, dunno. > It's a question whether any other sorting approaches end up being > helpful, but maybe some hybrid functions will work, where both > occurrences and flex score are taken into account. In this case I would first sort by occurance and then style-score. There's no easy way to make a hybrid function, so we must pick a default. For all the examples I've been given, it seems that flex-sorting should always come last. Since flex is the first and only style that carries some sorting idea with it, perhaps it's not a very bad idea to give it _some_ priority by default. >> Eventually, we can add a keybinding to resort exclusively according to >> the table or exclusively according to the completion style. > > In the approach I'm thinking of, both options are the same sorting > function. How would you synthetize it?=20 > And still, seeing it wouldn't help me if I'm just writing code. Sorry > for being blunt. I'm a big boy, I can take blunt... :-) > Sort by them, sure. But show the values to the user? Why? In the general case, so the user has an idea _why_ something is being automatically. Humans generally gain confidence in algorithms if they're shown human-comprehensible hints as to why it is is doing something (humans generally also like this from other humans, which explains why you ask me so many questions :-). In this particular case, it's a very common idiom when displaying tables/lists of something. Perhaps in the "occurance sorting" field, he/she will choose another word used less frequently for stylistic purposes. But, all that said, I'm not going to kill myself over the annotation, nor do I think it even merits a customization option, though it's probably not hard to do it anyway. > The former, more or less. This creates a certain limitation, sure, but > it shouldn't be a problem for Eglot. Hmm? By far, Eglot isn't the only one thing I'm interested in enhancing (actually, I've had few opportunities to actualy _use_ Eglot lately). Jo=E3o