[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug in minibuffer-complete-and-exit, fix included
From: |
Ryan Barrett |
Subject: |
bug in minibuffer-complete-and-exit, fix included |
Date: |
Tue, 27 Dec 2005 00:38:38 -0800 (PST) |
hi all. i recently noticed a bug in minibuffer-complete-and-exit. if
completion-ignore-case is t, and the minibuffer contains a valid completion in
the wrong case, its case isn't fixed. it should be.
sorry, that was a mouthful. :P here's an example. if foo is a possible
completion, and you enter FoO in the minibuffer, minibuffer-complete-and-exit
returns FoO. it should return foo instead.
this spreads to other code that uses the minibuffer. for example, read-buffer
has an optional arg require-match. if t, an existing buffer name must be
entered. the list of existing buffer names is used as completions. if
completion-ignore-case is t, and you enter an existing buffer name *in the
wrong case*, it's not completed to the right case. (same with read-file-name
and mustmatch.)
here's a test case. run emacs -q, then evaluate these forms:
(setq completion-ignore-case t)
(read-buffer "buffer name: " nil t)
enter *scrATCH* at the prompt. it returns *scrATCH*, but it should return
*scratch*.
the patch below, against CVS, fixes this. if i understand the process right,
it's small enough that you can include it without papers. hopefully it's also
small enough to consider for the emacs 22 release.
*** minibuf.c 21 Dec 2005 17:33:40 -0000 1.297
--- minibuf.c 27 Dec 2005 07:39:07 -0000
***************
*** 2139,2145 ****
if (STRINGP (compl)
/* If it weren't for this piece of paranoia, I'd replace
the whole thing with a call to do_completion. */
! && EQ (Flength (val), Flength (compl)))
{
del_range (XINT (Fminibuffer_prompt_end ()), ZV);
Finsert (1, &compl);
--- 2139,2145 ----
if (STRINGP (compl)
/* If it weren't for this piece of paranoia, I'd replace
the whole thing with a call to do_completion. */
! && EQ (XFASTINT (Flength (val)), XFASTINT (Flength (compl))))
{
del_range (XINT (Fminibuffer_prompt_end ()), ZV);
Finsert (1, &compl);
-Ryan
--
http://snarfed.org/
- bug in minibuffer-complete-and-exit, fix included,
Ryan Barrett <=