From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dario Gjorgjevski Newsgroups: gmane.emacs.bugs Subject: bug#42149: Substring and flex completion ignore implicit trailing =?UTF-8?Q?=E2=80=98any=E2=80=99?= Date: Wed, 25 Nov 2020 09:22:41 +0100 Message-ID: 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="34069"; 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, Stefan Monnier To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 25 09:23:46 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 1khq5E-0008Fy-BV for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Nov 2020 09:23:24 +0100 Original-Received: from localhost ([::1]:57126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1khq5D-00012e-A1 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Nov 2020 03:23:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khq4s-00011y-OK for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2020 03:23:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50847) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1khq4s-0005V1-Gr for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2020 03:23:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1khq4s-0000aK-CI for bug-gnu-emacs@gnu.org; Wed, 25 Nov 2020 03:23:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dario Gjorgjevski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Nov 2020 08:23: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.16062925722218 (code B ref 42149); Wed, 25 Nov 2020 08:23:02 +0000 Original-Received: (at 42149) by debbugs.gnu.org; 25 Nov 2020 08:22:52 +0000 Original-Received: from localhost ([127.0.0.1]:34160 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1khq4i-0000Zi-GL for submit@debbugs.gnu.org; Wed, 25 Nov 2020 03:22:52 -0500 Original-Received: from mail-ed1-f43.google.com ([209.85.208.43]:40391) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1khq4f-0000ZR-JN for 42149@debbugs.gnu.org; Wed, 25 Nov 2020 03:22:51 -0500 Original-Received: by mail-ed1-f43.google.com with SMTP id d18so1597574edt.7 for <42149@debbugs.gnu.org>; Wed, 25 Nov 2020 00:22:49 -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=IhsrFnLG8taAmDaH8Ut/gmn4TEuzHBMpn2MsDGW9MGI=; b=TWTbQEWtAQJpqWoVVkIzXBsGK5BPLPPOGNDk5LkTAcu8t26mGvs6ZGbe5BatVKZTV2 5GKKhY1bmhjSz8sFQiqhktWj5LnEyWSCEgjsOaGw5PcehBlzTD6R14axsstFqL3i1BM5 Nq+JrmikV1IAEKK4reFSzBopbWgsloPbHdnkxIf0ppSL13bDjLA9PIWtgExwf041PyTE C7/O42RZVbhTPe1Dq7lCPDgylLWeMW7jLP5F32IzppFaberluhZbD0zhYNkNf4AKsR2L q1hauWTiV6PFj3uyUiaE9BuhomvPMaDsElr8Vs6J2T2Yvnc5Cv0ph1Sm8UcIfm2rGk/T +dsA== 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=IhsrFnLG8taAmDaH8Ut/gmn4TEuzHBMpn2MsDGW9MGI=; b=Lk1Hhf1IDRY1uuj2wLTDr+qkwYJ/wcoxwd3bSA/cnjmxkA5gmc7A9GQyzNzPACcIz2 v+BRsNqSVdZu8zRExEKztUGv7Kn0PvyKN9VesgfNAtmdmIR5r4ri1NDoee0z7oFP0UOb YDUveA+nxhA/jRZ+eHQVP/K9eCDdoAK1geTeBiSogkySzGXMOOTY/9oyRnekHYy3ZAid WQIMHYV+SmXqkRhijiOxUJWS0ah6sjftgkbfjfTCVguVb6san6exFMZ3WsCrB2szkj3j 0loaRtd0gonUfqjrquK7SUykbVKDVhjIEMuxLbVzPa04yjVeU/dJuN4xg5E91mhxiUER KSUg== X-Gm-Message-State: AOAM532nQervxDbl+ptJ24d8+4F9KqWQEhlGXDvx/MJN5CyZ5CziOpBx ewsqu+ywSy9mrrEg5QL4nOP+bLjBjkM= X-Google-Smtp-Source: ABdhPJzNXVa8dNTukeHMTQEIZ6wGm+yGCKECzZEfXH6vCvCMYQtsXGeVNzUC8E5tz2qGIYchj22j7g== X-Received: by 2002:a05:6402:160f:: with SMTP id f15mr2404513edv.56.1606292563359; Wed, 25 Nov 2020 00:22:43 -0800 (PST) Original-Received: from ZALANDO-31298 ([79.140.123.81]) by smtp.gmail.com with ESMTPSA id y24sm749798edt.15.2020.11.25.00.22.42 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Nov 2020 00:22:42 -0800 (PST) In-Reply-To: ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Wed, 25 Nov 2020 00:01:41 +0000") 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:194168 Archived-At: Hi Jo=C3=A3o, > I took a better look at your patch finally, but I still > don't understand it fully. Thanks a lot. I think the best way to see what=E2=80=99s going on is to ta= ke the =E2=80=98completion-pcm--hilit-commonality=E2=80=99 function and, ironi= cally, do some printf() debugging. In the current implementation, if you insert (message "String: %s" str) in the initial lambda and (message "Found match [%d, %d]" a b) in =E2=80=98update-score=E2=80=99 and then you try the example from the comments (completion-flex-all-completions "foo" '("fabrobazo" "fbarbazoo" "barfoobaz") nil 3) you will see it prints String: fabrobazo Found match [0, 0] [2 times] Found match [0, 1] Found match [4, 5] Found match [9, 9] String: fbarbazoo Found match [0, 0] [2 times] Found match [0, 1] Found match [7, 8] Found match [9, 9] String: barfoobaz Found match [0, 0] [2 times] Found match [3, 4] Found match [4, 5] Found match [9, 9] Notice how the last matching character is *not processed* -- this is the essence of the bug. It=E2=80=99s easiest to see from =E2=80=98barfoobaz=E2= =80=99 where only [3, 4] (the =E2=80=98f=E2=80=99) and [4, 5] (the second =E2=80=98o=E2=80=99) ar= e processed, [5, 6] is nowhere to be seen. With my patch, the output becomes String: foobarbaz Found match [0, 1] Found match [1, 2] Found match [2, 3] String: fbarbazoo Found match [0, 1] Found match [7, 8] Found match [8, 9] String: barfoobaz Found match [3, 4] Found match [4, 5] Found match [5, 6] Which is all good. > Don't worry, I will soon. First thing I looked at > was the tests you provided, which are very welcome. > I restructured them, creating instead 13 small tests > instead of just 3 tests that currently fail. Thanks a lot once again, this is very appreciated. Admittedly, the tests weren=E2=80=99t very good and I wasn=E2=80=99t sure how to make them = better. > I'm the author of one of the commits there and credit > you as "Co-author". If you'd rather reverse that, let > me know. This is fine by me. Best regards, Dario --=20 $ keyserver=3Dhkps://hkps.pool.sks-keyservers.net $ keyid=3D744A4F0B4F1C9371 $ gpg --keyserver $keyserver --search-keys $keyid