From: Dario Gjorgjevski <dario.gjorgjevski@gmail.com>
To: "João Távora" <joaotavora@gmail.com>
Cc: 42149@debbugs.gnu.org
Subject: bug#42149: Substring and flex completion ignore implicit trailing ‘any’
Date: Tue, 08 Sep 2020 13:12:51 +0200 [thread overview]
Message-ID: <fv2zojh7s8h68c.fsf@gmail.com> (raw)
In-Reply-To: <CALDnm52gzPN7FgBejpkEUG1XwQK=v+-1vBiPSFthwWjb7eo9cg@mail.gmail.com> ("João Távora"'s message of "Tue, 8 Sep 2020 11:08:26 +0100")
[-- Attachment #1: Type: text/plain, Size: 1864 bytes --]
> 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
[-- Attachment #2: Add explicit trailing ‘any’ to substring completion --]
[-- Type: text/x-diff, Size: 531 bytes --]
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 ‘any’
(all (completion-pcm--all-completions prefix pattern table pred)))
(list all pattern prefix suffix (car bounds))))
[-- Attachment #3: Type: text/plain, Size: 152 bytes --]
--
dario.gjorgjevski@gmail.com :: +49 1525 8666837
% gpg --keyserver 'hkps://hkps.pool.sks-keyservers.net' \
\`> --recv-keys '744A4F0B4F1C9371'
next prev parent reply other threads:[~2020-09-08 11:12 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-01 10:40 bug#42149: Substring and flex completion ignore implicit trailing ‘any’ Dario Gjorgjevski
2020-07-01 10:58 ` João Távora
2020-07-01 11:03 ` João Távora
2020-07-01 11:10 ` Dario Gjorgjevski
2020-09-08 9:05 ` Dario Gjorgjevski
2020-09-08 9:30 ` João Távora
2020-09-08 9:44 ` Dario Gjorgjevski
2020-09-08 10:08 ` João Távora
2020-09-08 11:12 ` Dario Gjorgjevski [this message]
2020-09-08 11:22 ` João Távora
2020-09-08 11:30 ` Dario Gjorgjevski
2020-09-08 11:32 ` João Távora
2020-09-09 10:17 ` Dario Gjorgjevski
2020-09-09 11:38 ` Dario Gjorgjevski
2020-09-09 13:13 ` Stefan Monnier
2020-09-10 11:26 ` Dario Gjorgjevski
2020-10-14 8:22 ` Dario Gjorgjevski
2020-10-14 8:39 ` João Távora
2020-10-14 9:01 ` Dario Gjorgjevski
2020-10-15 14:25 ` Dario Gjorgjevski
2020-11-20 20:39 ` Dario Gjorgjevski
2020-11-20 21:27 ` João Távora
2020-11-25 0:01 ` João Távora
2020-11-25 8:22 ` Dario Gjorgjevski
2020-11-25 12:22 ` João Távora
2020-11-25 13:27 ` Dario Gjorgjevski
2020-12-23 9:41 ` Dario Gjorgjevski
2020-12-27 20:08 ` João Távora
2020-12-27 20:23 ` João Távora
2020-12-27 21:20 ` Stefan Monnier
2020-12-28 9:30 ` João Távora
2020-12-28 16:03 ` Stefan Monnier
2020-12-28 16:58 ` João Távora
2020-12-28 16:07 ` Stefan Monnier
2020-12-28 17:04 ` João Távora
2020-12-27 21:45 ` Stefan Monnier
2020-12-28 9:38 ` João Távora
2020-12-28 10:22 ` Dario Gjorgjevski
2020-12-28 11:34 ` João Távora
2020-12-28 11:48 ` Dario Gjorgjevski
2020-12-28 12:57 ` João Távora
2020-12-28 10:17 ` Dario Gjorgjevski
2020-12-28 16:26 ` Stefan Monnier
2020-12-28 17:16 ` João Távora
2020-12-28 19:48 ` Dario Gjorgjevski
2020-12-28 20:00 ` Stefan Monnier
2020-12-28 23:20 ` João Távora
2020-12-29 13:27 ` João Távora
2021-05-13 9:24 ` Lars Ingebrigtsen
2021-05-13 14:31 ` João Távora
2021-05-13 15:41 ` Dario Gjorgjevski
2021-05-13 16:04 ` João Távora
2021-05-16 13:51 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fv2zojh7s8h68c.fsf@gmail.com \
--to=dario.gjorgjevski@gmail.com \
--cc=42149@debbugs.gnu.org \
--cc=joaotavora@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).