GNU bug report logs -
#11339
24.1.50; read-{buffer,file-name}-completion-ignore-case fails on non-ascii
Previous Next
Reported by: Stephen Berman <stephen.berman <at> gmx.net>
Date: Wed, 25 Apr 2012 15:39:03 UTC
Severity: normal
Merged with 10211
Found in versions 24.0.92, 24.1.50, 27.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: stephen.berman <at> gmx.net, 11339 <at> debbugs.gnu.org, stefan <at> marxist.se
> Date: Fri, 08 Nov 2019 17:36:08 -0500
>
> > The patch below fixes Stefan's simplified test case, but the original
> > problem is still unsolved: "C-x b ba TAB TAB" says "Sole completion".
> >
> > What did I miss?
>
> It still fails when you swap the two elements in the list :-(
> I don't have time to dig into the code now, tho,
What about the below? It passes all the tests, and also fixes the
original use case.
diff --git a/src/minibuf.c b/src/minibuf.c
index f6cf47f..1e87c50 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1323,13 +1323,13 @@ DEFUN ("try-completion", Ftry_completion, Stry_completion, 2, 3, 0,
else
{
compare = min (bestmatchsize, SCHARS (eltstring));
- tem = Fcompare_strings (bestmatch, zero,
- make_fixnum (compare),
- eltstring, zero,
- make_fixnum (compare),
+ Lisp_Object lcompare = make_fixnum (compare);
+ tem = Fcompare_strings (bestmatch, zero, lcompare,
+ eltstring, zero, lcompare,
completion_ignore_case ? Qt : Qnil);
matchsize = EQ (tem, Qt) ? compare : eabs (XFIXNUM (tem)) - 1;
+ Lisp_Object old_bestmatch = bestmatch;
if (completion_ignore_case)
{
/* If this is an exact match except for case,
@@ -1363,7 +1363,12 @@ DEFUN ("try-completion", Ftry_completion, Stry_completion, 2, 3, 0,
bestmatch = eltstring;
}
if (bestmatchsize != SCHARS (eltstring)
- || bestmatchsize != matchsize)
+ || bestmatchsize != matchsize
+ || (completion_ignore_case
+ && !EQ (Fcompare_strings (old_bestmatch, zero, lcompare,
+ eltstring, zero, lcompare,
+ Qnil),
+ Qt)))
/* Don't count the same string multiple times. */
matchcount += matchcount <= 1;
bestmatchsize = matchsize;
This bug report was last modified 5 years and 191 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.