Subject: RE: bug#1667: 23.0.60;env var completion in shell mode - case sensitivity

From: "Drew Adams" <[email-masked]>
Date: Tue, 30 Dec 2008 14:33:34 -0800

> From: Drew Adams Sent: Sunday, December 21, 2008 4:11 PM
> emacs -Q
>  
> I'm on MS Windows. I load these two files, in order:
> http://www.emacswiki.org/emacs/cygwin-mount.el
> http://www.emacswiki.org/emacs/setup-cygwin.el
>  
> M-x shell
>  
> In buffer *shell*, I type lowercase "$hom", then hit TAB. It completes
> to "$homE".
>  
> Dunno whether that is TRT (probably not), but when I hit TAB a second
> time, it shows no possible completions. Whereas, there are these
> completions for "$HOME": "HOME", "HOMEDRIVE", "HOMEPATH".
> 
> The same bug appears in Emacs 22.
> 
> In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
>  of 2008-12-19 on LENNART-69DE564
> Windowing system distributor `Microsoft Corp.', version 5.1.2600
> configured using `configure --with-gcc (3.4) --no-opt 
> --cflags -Ic:/g/include -fno-crossjumping'

FYI - The problem comes from the two calls to `string-equal' in the definition
of `comint-dynamic-simple-complete'. Even though the function goes to the
trouble of binding `completion-ignore-case', it defeats this by using
`string-equal', which takes no account of `completion-ignore-case'. 

`comint-dynamic-simple-complete' is general, and can be used for different
thingies - in this case, it is called by
`shell-dynamic-complete-as-environment-variable'. Should env var completion be
case-insensitive on Windows? (dunno)

Either (1) The calling program needs some control over the behavior of
`completion-ignore-case' wrt case, so it can have a say in whether completion
should be case-sensitive for a particular kind of thingy (e.g. env vars). Or (2)
case-insensitive string comparison should be used everywhere in
`comint-dynamic-simple-complete', for (memq system-type '(ms-dos windows-nt
cygwin)).