GNU bug report logs - #42149
Substring and flex completion ignore implicit trailing ‘any’

Previous Next

Package: emacs;

Reported by: Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>

Date: Wed, 1 Jul 2020 10:41:01 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dario Gjorgjevski <dario.gjorgjevski <at> gmail.com>
To: João Távora <joaotavora <at> gmail.com>
Cc: 42149 <at> debbugs.gnu.org
Subject: bug#42149: Substring and flex completion ignore implicit trailing ‘any’
Date: Tue, 08 Sep 2020 13:12:51 +0200
[Message part 1 (text/plain, inline)]
> 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 ‘emacs -Q’ in a directory with two files: “1” and “foo1”.
1. Enable fido-mode.
2. C-x C-f 1 RET.

Emacs will open “foo1” even though I would expect it to open “1” 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

[completion-substring--all-completions.diff (text/x-diff, attachment)]
[Message part 3 (text/plain, inline)]
-- 
dario.gjorgjevski <at> gmail.com :: +49 1525 8666837
%   gpg --keyserver 'hkps://hkps.pool.sks-keyservers.net' \
\`>     --recv-keys '744A4F0B4F1C9371'

This bug report was last modified 4 years and 7 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.