all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ryan Barrett <emacs@ryanb.org>
Subject: bug in minibuffer-complete-and-exit, fix included
Date: Tue, 27 Dec 2005 00:38:38 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0512262326110.18163@davis.corp.google.com> (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/

             reply	other threads:[~2005-12-27  8:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-27  8:38 Ryan Barrett [this message]
2005-12-27 16:36 ` bug in minibuffer-complete-and-exit, fix included 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

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0512262326110.18163@davis.corp.google.com \
    --to=emacs@ryanb.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.