From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: BIKESHED: completion faces Date: Tue, 29 Oct 2019 21:49:15 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="201989"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 30 02:50:18 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.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iPd7p-000qRa-RM for ged-emacs-devel@m.gmane.org; Wed, 30 Oct 2019 02:50:18 +0100 Original-Received: from localhost ([::1]:35956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPd7o-0007wt-F2 for ged-emacs-devel@m.gmane.org; Tue, 29 Oct 2019 21:50:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59402) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPd72-0007uC-JI for emacs-devel@gnu.org; Tue, 29 Oct 2019 21:49:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPd70-0000Qi-GO for emacs-devel@gnu.org; Tue, 29 Oct 2019 21:49:27 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:46929) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iPd6z-0000Pg-Bw for emacs-devel@gnu.org; Tue, 29 Oct 2019 21:49:25 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 4620F4495E9; Tue, 29 Oct 2019 21:49:23 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D45014495E3; Tue, 29 Oct 2019 21:49:21 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1572400161; bh=yZNudI8TvWc1aIpltWBuMPevmATLIWwlNHifoWhdWaA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=h7tAXypwTPPc08Q8uDCezQKS8vHie5TfuDEGK04fQ9qcJQDpfrX5MfZigEy8/ZBrr XaSLmDwQFORFvbCIn4IIhAzpneDs174DFsY9W9ARZg90xkE3ypA2Z05j3kz0qUUfSl OtZMaYKuYBdEfk4KZ1KYa3I0hM1NGW21rXZVeiMFYheo+aFpKbm1U6RM30PTuF2YDs QmqzWh1Hem/JCjs3wqIdRlOTivwlEFCMlhXC/jI6foDxiD4E1dUVP+yBE+lp+iuD4u aciouDSkzqvBC7RHlKGIvORQ3LJK0w5orzunYVRal9Wd9cXTxnr2ouuixGQcoXULOu t4FjF2zo9KnkQ== Original-Received: from pastel (unknown [45.72.255.86]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8F7FE1202C5; Tue, 29 Oct 2019 21:49:21 -0400 (EDT) In-Reply-To: (Dmitry Gutov's message of "Wed, 30 Oct 2019 01:11:52 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 132.204.25.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:241615 Archived-At: > I wonder if it's *that* important, to be able to see the matching chars. It has an explanatory value which makes the completion-style more understandable (e.g. I'm pretty sure there are still users who don't know about the `partial-completion` style that's enabled by default: they just occasionally see completion lists which they don't understand and shrug it off). But no, I don't know how important it is (I do find it useful when implementing/debugging the code to make sure it worked right ;-) This said, it seems that highlighting the common part is the "standard" behavior is all other completion systems whereas highlighting the "first difference" seems to be specific to Emacs. >> For this reason, it is common in other completion systems to >> highlight the "common" part somehow (e.g. underline, bold, ...). > Personally, I'm not a big fan of underline, italic and even bold (unless > it's used sparingly, like it is now). With that said... FWIW, I'm no big fan of underline (maybe it's the LaTeX influence speaking). But I found it tolerable for first-difference after trying it out. Stefan > The -first-difference face shows actionable info: the next character > to type, to narrow down the completions list as much as possible while > ensuring that a given completion is still in. [...] > Furthermore, the position of -first-difference also hints at what > characters were matched (definitely ones before it). [...] > The "first difference" character is simply the one after the last > segment of the common part, isn't it? Agreed. This is largely irrelevant for the choice of bikeshed color, but I figure it's as a good a time as any to clarify that the above, while largely true is not quite right either: It's a bit more subtle than that (and the "first-difference" name is a misnomer, due to history): when I revamped the default completion system for Emacs-24, adding partial-completion (as well as `basic` which is a bit more sophisticated than just "prefix completion", in reality), I had to decide what to do with "first-difference" since it doesn't have as clear a meaning as for the plain old prefix completion. So the way I adapted it to the new reality is that "first difference" now really means "first char after point". If you do M-x dovi C-b C-b ? you'll see that `completions-first-difference` is applied to the "c" of the "doc-view..." commands because that's the first character after the position in the candidate that corresponds to the position of point in the pattern. So strictly speaking: - No, there can also be common-part characters after first-difference - Also, it's not always the case that the "first-difference" character is "the next character to type, to narrow down the completions list as much as possible while ensuring that a given completion is still in". Two reasons for that: 1- the "first-difference" character may already be part of the "common part". E.g. `M-x revert C-b ?` will show the `t` with both `completions-first-difference` and `completion-common-part` and typing `t` will actually end up with a pattern that doesn't match anything. 2- depending on the completion style, there might be further character that still keep the desired completion while eliminating more of the others. For example let's say you want to run `doc-view-fit-height-to-window`; after you do `M-x doc-view- ?` you'll see that the `f` is highlighted as first-difference but if hit `f` you still have 5 remaining choices, whereas if you hit `h` your choice is the only remaining one. But by and large, these are exceptions. Point (2) above is a bit more true for `flex`, but I don't think it matters very much anyway.