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, 01 Jul 2020 13:10:44 +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="13068"; 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 Wed Jul 01 13:11:10 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 1jqady-0003KL-8L for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 01 Jul 2020 13:11:10 +0200 Original-Received: from localhost ([::1]:59426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jqadx-0007Lw-AV for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 01 Jul 2020 07:11:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48664) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jqadq-0007Lk-Eg for bug-gnu-emacs@gnu.org; Wed, 01 Jul 2020 07:11:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40863) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jqadq-0005NI-5a for bug-gnu-emacs@gnu.org; Wed, 01 Jul 2020 07:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jqadq-0004IN-0U for bug-gnu-emacs@gnu.org; Wed, 01 Jul 2020 07:11: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: Wed, 01 Jul 2020 11:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42149 X-GNU-PR-Package: emacs Original-Received: via spool by 42149-submit@debbugs.gnu.org id=B42149.159360185516498 (code B ref 42149); Wed, 01 Jul 2020 11:11:01 +0000 Original-Received: (at 42149) by debbugs.gnu.org; 1 Jul 2020 11:10:55 +0000 Original-Received: from localhost ([127.0.0.1]:52409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jqadj-0004I2-66 for submit@debbugs.gnu.org; Wed, 01 Jul 2020 07:10:55 -0400 Original-Received: from mail-ed1-f51.google.com ([209.85.208.51]:42764) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jqadg-0004Hl-JR for 42149@debbugs.gnu.org; Wed, 01 Jul 2020 07:10:53 -0400 Original-Received: by mail-ed1-f51.google.com with SMTP id z17so19273902edr.9 for <42149@debbugs.gnu.org>; Wed, 01 Jul 2020 04:10:52 -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=DawbKwjJIbd0oiPoB76N2VjbRgjtBs+eh64fDEzxELo=; b=kq++42H/4so68jMgAOC5I4ZUt4Y3Dmk4OMFLbSz6qEtC6SuiDqSeJABiMFBQRAkelm wxAM40YXR7iZhPOswupH3JqbiR7IEbc6v4M77LXdL5OzLude64iBxjOY9BA0faapG2Uf 5I+BwTsJ4GZrjDYxY9GH4zq+dZzhIqWEUSFNI2alyEh9mbGtdR0vdbS9uGG4Z38QD1Hc kw0yuOe91pKCU77ExSyu+LhwqrXU1hSupJUYlv4Zn2IJzGkqO+WFepFGHiDsMVL/gh2d cY21sDROf0/ggnLrvGhN5hUGsY/wO5MyOxG6cGWwjUCrSW3uK8bRVxGkN6ZUMFaiYN7R +5YA== 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=DawbKwjJIbd0oiPoB76N2VjbRgjtBs+eh64fDEzxELo=; b=oMbrilI/oDqV7kdMcAp6awUIzesukeNxD+jI1p2eDSrrkRBjEsjQCv8E4/WFkG7CAS etPZ87Wx50OUoKkmpHhEgNWi3uUkS8eeg0rWJKVurEFUIrf4WbRa0yTje3qf45iVBffK NH466jqGPFfnr1VS/AkxeAVmJJiuZJhX1qbw8AFgExi/mPlIVqgdo8eiPVG7bUz2aaEW T3udGKfeaVuianhDJbqboF2DEAHFdlMsGdWBd0s2jEUc3HJdu4LknWKwXFc3Z9eI8ken HHKwy0nx83ooPLNrfE2Dh3r8EmKbRtTgp84HVozPm5qhXno7M/jwM0xx6xwryctM3CE3 x37w== X-Gm-Message-State: AOAM5316lCu7Wq8zwK+lFExhgyvShjDjlDm5Ph4Bf044CmfeAIyJgnZo 4ri4r1iqe/VIV2/SpnSymNgEpGKc X-Google-Smtp-Source: ABdhPJybXTrPOUXPMdDxSKApTr4AwrohIUf22B2WpPV3ePe6GDn8MEJ0rwNMvoyZ7h0jLJO/OQKrUg== X-Received: by 2002:aa7:cdca:: with SMTP id h10mr14875826edw.285.1593601846184; Wed, 01 Jul 2020 04:10:46 -0700 (PDT) Original-Received: from ZALANDO-31298 ([79.140.115.99]) by smtp.gmail.com with ESMTPSA id mf24sm4348059ejb.58.2020.07.01.04.10.45 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Jul 2020 04:10:45 -0700 (PDT) In-Reply-To: <87k0znsdjb.fsf@gmail.com> ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Wed, 01 Jul 2020 12:03:20 +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:182599 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Jo=C3=A3o, > I still don't know what the proper fix this, just adding some > information I think is relevant. Indeed the problem is that they all get a completion score of 0, and I would expect the exact match to get a score of 1. You=E2=80=99re right that we can also modify the algorithm of =E2=80=98completion-pcm--hilit-commonality=E2=80=99. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=completion-pcm--hilit-commonality.diff Content-Description: Modify the algorithm of =?utf-8?Q?=E2=80=98completion-pcm--hilit-commonali?= =?utf-8?Q?ty=E2=80=99?= diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index d2c3f9045e..e1f1ffed1c 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3251,6 +3251,9 @@ one-letter-long matches).") (update-score (lambda (a b) "Update score variables given match range (A B)." + (add-face-text-property a b + 'completions-common-part + nil str) (setq score-numerator (+ score-numerator (- b a))) (unless (or (= a last-b) @@ -3264,19 +3267,10 @@ one-letter-long matches).") flex-score-match-tightness))))) (setq last-b b)))) - (funcall update-score start start) (while md - (funcall update-score start (car md)) - (add-face-text-property - start (pop md) - 'completions-common-part - nil str) + (funcall update-score start (pop md)) (setq start (pop md))) - (funcall update-score len len) - (add-face-text-property - start end - 'completions-common-part - nil str) + (funcall update-score start end) (if (> (length str) pos) (add-face-text-property pos (1+ pos) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable This modification also solves the issue (and simplifies the code a little bit), but I=E2=80=99m not sure of unwanted side effects. Best regards, Dario --=20 dario.gjorgjevski@gmail.com :: +49 1525 8666837 % gpg --keyserver 'hkps://hkps.pool.sks-keyservers.net' \ \`> --recv-keys '744A4F0B4F1C9371' --=-=-=--