From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= 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 17:16:48 +0000 Message-ID: <877dp1kfzz.fsf@gmail.com> References: <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="33057"; 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, Dario Gjorgjevski To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 28 18:18:24 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 1ktwA4-0008P4-7V for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 28 Dec 2020 18:18:24 +0100 Original-Received: from localhost ([::1]:46776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktwA3-0003Yt-A1 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 28 Dec 2020 12:18:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktw8k-0002if-86 for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2020 12:17:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53399) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ktw8k-0007SQ-0K for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2020 12:17:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ktw8j-00054f-RB for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2020 12:17:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Dec 2020 17:17:01 +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.160917581919490 (code B ref 42149); Mon, 28 Dec 2020 17:17:01 +0000 Original-Received: (at 42149) by debbugs.gnu.org; 28 Dec 2020 17:16:59 +0000 Original-Received: from localhost ([127.0.0.1]:36712 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktw8g-00054I-Ty for submit@debbugs.gnu.org; Mon, 28 Dec 2020 12:16:59 -0500 Original-Received: from mail-wm1-f49.google.com ([209.85.128.49]:35767) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktw8e-00053u-7q for 42149@debbugs.gnu.org; Mon, 28 Dec 2020 12:16:56 -0500 Original-Received: by mail-wm1-f49.google.com with SMTP id e25so10366149wme.0 for <42149@debbugs.gnu.org>; Mon, 28 Dec 2020 09:16:56 -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=/KewdaImyXmBgBBYFXkxtdHanGI2kU3YYSfV02wMG/8=; b=M5Ds+wCgl5BtTt1gQXQK0az50MHNsA0IvAeyFSP39zbrJE2ZEe+t4tL29Lf+l62oSe GKOWt/JLQNOkRAAC+jdNYIHoKCsJRNS2aptXGY36TTCpS1+dzaSCvCNLeArF6VNUsycV liQ4gd4yfPIfTAxAX/9Q4S1aXOpL5LrbDCYkhWE+GSM9e3N8LNJ1ftE+NoOY1JP9VZp0 l2hExB/S1jJnpD1B9r92Qs9A4jo0U6no3sL2+dUaPs3HqkIXw9FhJ30GchZxBN9xR8kG ye9Ea3IsXySybyHA6T2b2houZ+v8iBkpH8fKBmHVrtIsIZ7WN2vpuHZFWXmTDg/qUx2s MGLA== 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=/KewdaImyXmBgBBYFXkxtdHanGI2kU3YYSfV02wMG/8=; b=dSC6hhsN2hV4KiRqOu5XL1TQ6idcyw3S60plTSfpA8qebN+8pkbgFBTVkliqo/b+X4 Vxcpw8NoNKvnmJS+cUT11I5Y3Lsj0dmrFmWW9jeQACcQEO/Tg8D4q8wUbf50zPv1Hpza LBsOZv8Fimj8WRRHXE6aSC3AOHQI3MceRZFryRw6K3Cu0NTY2ZtGqqQu2ndkeMYykTd0 0k/0NFp4XIr5TT3A2bB/8ahkc1mXdizGxMtQYH77Z7jHPy8DArp0RyhAIj3S2Z78kLg1 eH7IDhwSd2bg0NFxWlGAwYjoChZ1Pshu5nLE87d2Nq9i2q1djYdjRTIVtNBv32ho2Zya lwAQ== X-Gm-Message-State: AOAM533UVVWIhjvFZx99NW7qnwldFtgfkf3oWd3TobYmqccYh0CFdz6C VMmoryRKZ4lJaLMLBSHSO0TvuYVDnu8= X-Google-Smtp-Source: ABdhPJx8yr4vr08M4+dS3VFhUgRCCvI0iNiT0D5l6mTWFQToYXfThQIK+SJnRiGfSvmPPNdnDlEAFw== X-Received: by 2002:a1c:9acb:: with SMTP id c194mr20919103wme.43.1609175809931; Mon, 28 Dec 2020 09:16:49 -0800 (PST) Original-Received: from krug (6.213.115.89.rev.vodafone.pt. [89.115.213.6]) by smtp.gmail.com with ESMTPSA id z63sm21900720wme.8.2020.12.28.09.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 09:16:49 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Mon, 28 Dec 2020 11:26:00 -0500") 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:196878 Archived-At: Stefan Monnier writes: >> `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 I agree with this general idea. I think we have to be careful to write tests in terms of user experience as much as possible. For example, in the very latest version of the code I pushed, I still have one of Dario's original tests failing (down to only two now). completion-substring-test-4 Actually, only 1 of 3 of its assertions is failing (and this is an argument for splitting it up further). This is that assertion: (should (equal (completion--pcm-first-difference-pos (car (completion-substring-all-completions "jab" '("dabjabstabby" "many") nil 1))) 6)) The number returned by the current code is 4, and not 6. Maybe this is wrong, but I don't know if it makes a difference. If I evaluate (let ((completion-styles '(substring))) (completing-read "hey? " '("dabjabstabby" "dabjabfooey" "many"))) ... and then type "jab", backtrack two characters, and type TAB. I see the 's' of stabby and the 'f' of fooey being highlighted as the "next character to type". I also see "jab" correctly highlighted. Exactly as expected. Likewise if I evaluate this: (let ((completion-styles '(partial-completion))) (completing-read "hey? " '("few" "many" "foo"))) which is similar to the other failing test. Anyway, what I mean is that we need to see tests that tell us when things are failing at this level. It's not always easy to write such tests: we should pick "public" interfaces carefully (regardless of these problems Dario did a great job with the new tests, which are certainly better than the pure nothing we had there.) Jo=C3=A3o