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: Tue, 08 Sep 2020 13:12:51 +0200 Message-ID: References: <87k0znsdjb.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34048"; 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 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 Tue Sep 08 13:14:31 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 1kFba1-0008jD-QC for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Sep 2020 13:14:29 +0200 Original-Received: from localhost ([::1]:43184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFba0-0005ej-Sm for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Sep 2020 07:14:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFbZa-0005P0-FF for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2020 07:14:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40646) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFbZa-0006bO-5g for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2020 07:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kFbZa-0004Tt-0Y for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2020 07:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dario Gjorgjevski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Sep 2020 11:14: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.159956358217147 (code B ref 42149); Tue, 08 Sep 2020 11:14:01 +0000 Original-Received: (at 42149) by debbugs.gnu.org; 8 Sep 2020 11:13:02 +0000 Original-Received: from localhost ([127.0.0.1]:52192 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kFbYb-0004SU-Vu for submit@debbugs.gnu.org; Tue, 08 Sep 2020 07:13:02 -0400 Original-Received: from mail-ed1-f44.google.com ([209.85.208.44]:44136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kFbYZ-0004Ry-MP for 42149@debbugs.gnu.org; Tue, 08 Sep 2020 07:13:00 -0400 Original-Received: by mail-ed1-f44.google.com with SMTP id b12so15535685edz.11 for <42149@debbugs.gnu.org>; Tue, 08 Sep 2020 04:12:59 -0700 (PDT) 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; bh=rOC7/44urFxnQ5dYxErtty4/ikoCcFFXFbVTf3h6INU=; b=Ee97H74vQ5/1JojubKvQX1fC4PhQIGernx4cT2XuJIMBO37hT0Jj9rf0+t0a8zI2MV g8Id8H+jEOdlmD7a64U9XUUU0zIVn2aD9q65ZnXCqUFTykw2CwWMLv43g7Yaf5egqHDf on9mcaYbmEAs53RRF+b2toqeqTrGWZLkgf/MoFT6Ftg4Od8OsBLyVyX0j6Bj2EBHftzD jCgvNbI6HnCdS4b8KHopH9nlNsS1lwNEE+6nhdPfCdAnhvwAAQb2EiBufBcCN2OlCP/G HcEloZBLu4/TxdYqvvxlMgCe0qjoMDvL0iFjWjpmN8Jx4f/0jQxnTgLS7eesgvuJzsHa q2dA== 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; bh=rOC7/44urFxnQ5dYxErtty4/ikoCcFFXFbVTf3h6INU=; b=uEZwNaQuM1hRUyrGfGqRT19zF5omSWZvt98sx6Ib1oBIi5l/XvGxcKOt4adWIc6R7u ynlRzvs0IramBNvzFNe4cDDsj9kF0ZTUKPamdgbcECOAYFIiZHC0VfKYn92NeFwijMtT N07nDOXblXiIjCjI5uvAOhv/EDS8l6BI0JF/atErTsyfyuyx0qUw/tuQt9jyD+yiux0l xKSnrXuUtRHUrGV/0744ATMiKEiKHmfyODTTeRzt1cZbz0OQxZUpnS0SA9wSjDmu0ltc vxW5qmBxCSUGCY/g3UVKA7HIk0zTxzT+BQRpj0bNzVkUngSh+Op3Fq+xkPw4FGAf2NPC UleQ== X-Gm-Message-State: AOAM5302VJCAj1EqML8VSdgAfjAtkBWX0arVyVRGDos0uoM2w4HqNpvA vwH2Gy4gKdlqplrZrOwhidbRiK0oo/BtmA== X-Google-Smtp-Source: ABdhPJz0IpGxb3buioe0uYImory+igKbyIlSvt6vIVNbaip2GP/dwRWN4rxCar99C/JJAWcPmOlzRw== X-Received: by 2002:a05:6402:48a:: with SMTP id k10mr11941917edv.22.1599563573528; Tue, 08 Sep 2020 04:12:53 -0700 (PDT) Original-Received: from ZALANDO-31298 ([79.140.114.32]) by smtp.gmail.com with ESMTPSA id lz22sm16914616ejb.98.2020.09.08.04.12.51 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Sep 2020 04:12:52 -0700 (PDT) In-Reply-To: ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Tue, 8 Sep 2020 11:08:26 +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:187534 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > Is this is vanilla emacs, or are you using some icomplete-mode or > fido-mode? > I.e. can you post the entire Emacs -Q recipe? It is really simple to reproduce. 0. Run =E2=80=98emacs -Q=E2=80=99 in a directory with two files: =E2=80=9C1= =E2=80=9D and =E2=80=9Cfoo1=E2=80=9D. 1. Enable fido-mode. 2. C-x C-f 1 RET. Emacs will open =E2=80=9Cfoo1=E2=80=9D even though I would expect it to ope= n =E2=80=9C1=E2=80=9D as that is an exact match. But, I really think this is a pointless discussion. The issue *is not caused by fido-mode* but by the mechanism of substring (and therefore, flex) completion. You can also trigger it without fido-mode by invoking minibuffer-force-complete-and-exit. (completion-flex-all-completions "1" '("1" "11" "1122") nil 1) (completion-substring-all-completions "1" '("1" "11" "1122") nil 1) Both return completely the nonsensical result of (#("1" 0 1 (face completions-common-part completion-score 0.0)) #("11" 0 1 (face completions-common-part completion-score 0.0) 1 2 (face completions-first-difference)) #("1122" 0 1 (face completions-common-part completion-score 0.0) 1 2 (face completions-first-difference)) . 0) (Why are all the completion-score values 0?) Applying the attached patch changes the result to (#("1" 0 1 (face completions-common-part completion-score 1.0)) #("11" 0 1 (face completions-common-part completion-score 0.5) 1 2 (face completions-first-difference)) #("1122" 0 1 (face completions-common-part completion-score 0.25) 1 2 (face completions-first-difference)) . 0) which I hope you would agree makes a lot more sense. > M-j instead of RET in these one-letter completion cases. Or even C-u > M-j, if that doesn't work. Sure, but my muscle memory opposes that. Best regards, Dario --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=completion-substring--all-completions.diff Content-Transfer-Encoding: quoted-printable Content-Description: Add explicit trailing =?utf-8?B?4oCYYW554oCZ?= to substring completion diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 6deb1eb077..cfcf0fdccb 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3581,6 +3581,7 @@ that is non-nil." (if transform-pattern-fn (funcall transform-pattern-fn pattern) pattern))) + (pattern (append pattern '(any))) ; explicit trailing =E2=80=98any=E2=80= =99 (all (completion-pcm--all-completions prefix pattern table pred))) (list all pattern prefix suffix (car bounds)))) =20 --=-=-= Content-Type: text/plain -- dario.gjorgjevski@gmail.com :: +49 1525 8666837 % gpg --keyserver 'hkps://hkps.pool.sks-keyservers.net' \ \`> --recv-keys '744A4F0B4F1C9371' --=-=-=--