unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug in minibuffer-complete-and-exit, fix included
@ 2005-12-27  8:38 Ryan Barrett
  2005-12-27 16:36 ` Stefan Monnier
  2005-12-27 18:27 ` Stefan Monnier
  0 siblings, 2 replies; 8+ messages in thread
From: Ryan Barrett @ 2005-12-27  8:38 UTC (permalink / raw)


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/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-12-31  1:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-27  8:38 bug in minibuffer-complete-and-exit, fix included Ryan Barrett
2005-12-27 16:36 ` Stefan Monnier
2005-12-28 20:19   ` Ryan Barrett
2005-12-29  3:13     ` Stefan Monnier
2005-12-29 17:10     ` Richard M. Stallman
2005-12-31  1:49     ` Ryan Barrett
2005-12-27 18:27 ` Stefan Monnier
2005-12-27 18:51   ` Kevin Rodgers

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).