From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#42149: Substring and flex completion ignore implicit trailing =?UTF-8?Q?=E2=80=98any=E2=80=99?= Date: Mon, 28 Dec 2020 11:26:00 -0500 Message-ID: References: <87k0znsdjb.fsf@gmail.com> <87sgbsv7gg.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35927"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 42149@debbugs.gnu.org, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= To: Dario Gjorgjevski Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 28 17:27:17 2020 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 1ktvMb-0009FG-8V for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 28 Dec 2020 17:27:17 +0100 Original-Received: from localhost ([::1]:47758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktvMa-0001NF-4c for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 28 Dec 2020 11:27:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktvMO-0001N6-3q for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2020 11:27:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53283) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ktvMM-0007gS-CN for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2020 11:27:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ktvMM-0003gn-8E for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2020 11:27:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Dec 2020 16:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42149 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 42149-submit@debbugs.gnu.org id=B42149.160917277514119 (code B ref 42149); Mon, 28 Dec 2020 16:27:02 +0000 Original-Received: (at 42149) by debbugs.gnu.org; 28 Dec 2020 16:26:15 +0000 Original-Received: from localhost ([127.0.0.1]:36596 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktvLb-0003ff-9u for submit@debbugs.gnu.org; Mon, 28 Dec 2020 11:26:15 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:64234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktvLX-0003fK-Uy for 42149@debbugs.gnu.org; Mon, 28 Dec 2020 11:26:14 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 4C5E28058D; Mon, 28 Dec 2020 11:26:06 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C7178801A3; Mon, 28 Dec 2020 11:26:01 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1609172761; bh=zjEgR2YJodP2NqY2sAqdaA2qY7a9ufic5H5Maw0SGy0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=TpfwUQ/9auZYvxlkx0TmbTsWjlky7uqq2JyayTRu8NsVshW4qdXJfF5He3HqhRXmB 2yJbvOlVdoY/rmgRKn/4e3RiTw05aJr1Q9li+/emRn5qV4RjzubkYl4n6hBoExLtYM L9b9+/rlG5J9nz91+WVGu8CLW2dD22F+Mnom4s+KWqkOZynB2D45bDVah/vAANTq11 bwD5nZnGFP+7/lw0LJ3CF6ADX6wYe3TA1ppPAcW33zOE9hnMc1sXHy8qnfNDBToNNo ZImyz6KSedClVAcGVKA7O6G+zbGcWp4+8C8FRGJZoN2T65iL5x7kLvTf2oVrA2JSuw bM7oquCFE7vjw== Original-Received: from alfajor (unknown [104.247.243.191]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6C3781201FA; Mon, 28 Dec 2020 11:26:01 -0500 (EST) In-Reply-To: (Dario Gjorgjevski's message of "Mon, 28 Dec 2020 11:17:40 +0100") 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:196873 Archived-At: >>> The latter is fixed by explicitly moving >>> the position of =E2=80=98completions-first-difference=E2=80=99 in case = an overlap with >>> =E2=80=98completions-common-part=E2=80=99 is detected. >> >> Did you (by any chance) figure out how/why the two end up overlapping? >> The fix you're using looks pretty "hackish" and introduces a non-trivial >> data flow for `pos`. Before using such an ad-hoc solution it'd be best >> to understand where the problem comes from (it might still be the >> better answer in the end, but it's hard to judge). > > `completions-first-difference' is put at the first position after point > in the query string. Oh, yes, I remember the problem is in the name: it is not really used to highlight the first difference, but rather something like the "next character to type" (which happens to be the first difference in the simplest case of prefix completion). In the example you show, I think overlapping *is* as good a behavior as any other (and the code is careful to to replace one face with the other but to actually put both faces there, so you get a bold-blue instead of either bold or blue). Moving the highlighting to the next character like you've done seems actually worse in this case (e.g. if you're completing ("f" . 0) against ("foo" "barfoo"), it's rather odd to highlight the "b" of "barfoo" and the first "o" of "foo"). [ BTW, I notice that we have a bug currently in the highlighting: M-x for-s C-a ? correctly puts "for" and "s" in blue in the completion list, whereas M-x for C-a ? somehow fails to put "for" in blue :-( >> This is good (consecutive `any` can introduce serious performance bugs >> because of our backtracing regexp matcher). >> Other than improving performance, have you found other effects? > > Yes, the presence of multiple consecutive wildcards invalidates the > aforementioned assumption of completion-pcm--hilit-commonality that the > match is of the form > > ... Makes sense, thank you. Stefan