Subject: Re: bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows

From: Chong Yidong <[email-masked]>
Date: Fri, 04 May 2012 23:36:51 +0800

Eli Zaretskii <[email-masked]> writes:

>> The black magic occurs in `comint--complete-file-name-data' in
>> comint.el.  You could first try to evaluate
>> 
>>   (completion-file-name-table "d:\gnu" nil t)
>> 
>> and see if that does something funny.
>
> Thanks, I will take a look.

FWIW, here is my impression.  Emacs 23.4 has the following code in
`comint-dynamic-complete-as-filename':

   (let ((file (concat (file-name-as-directory directory) completion)))
     ;; Insert completion.  Note that the completion string
     ;; may have a different case than what's in the prompt,
     ;; if read-file-name-completion-ignore-case is non-nil,
     (delete-region filename-beg filename-end)
     (if filedir (insert (comint-quote-filename filedir)))

If I'm not mistaken, this is the part that turns d:\gnu into d:/gnu.

Emacs 24 uses the completion-at-point mechanism.  The equivalent code
responsible for replacing the quoted prefix is (IIUC) the `prefixes'
stuff in comint--complete-file-name-data, around comint.el:3178.
That's probably where the bug lies.