help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file name Completion in Shell (cmd.exe) on Emacs (MS Windows)


From: Sandip Chitale
Subject: Re: file name Completion in Shell (cmd.exe) on Emacs (MS Windows)
Date: Wed, 21 Jul 2004 10:47:14 -0700

I got a lot of suggestions to use other shells like bash and eshell etc.
However the problem with the cmd.exe still remains.

The issue I am talking about is specific to the Microsoft windows (NT, XP)
command prompt i.e. cmd.exe. The cmd.exe has a command:

C:\ > D:

D:\ >

to switch drives.

However, the code in shell-mode (shell.el) does not seem to *correctly*
switch the notion of default-directory for the *shell* buffer when drive
switching command is issued (well, it attempts to deal with the issue but
defun cd in files.el seems to have a bug (related to filename-abosolute-p
predicate) which prevents this from working).

The file completion works relative to default-directory of the buffer. Thus
the file completions I get are not relative to the new drive and hence new
current directory.

One more subtle issue is that cmd.exe seems to remember current directory
for each drive which is restored when the user switches to that drive. For
example:

C:\ > pwd

C:\

C:\ > D:

D:\ >

C:\ > C:

C:\ > cd \WINDOWS

C:\WINDOWS > D:

D:\ > C:

C:\WINDOWS >

Notice how the C:\WINDOWS was remembered as the last current directory for
C: drive.

(I have hacked the shell.el to do this by maintaining an assoc list of drive
to current directory on the drive which is updated before switching the
drive. The association list is used to restire the directory after switching
the drive. If a mapping is not found the root directory of the default is
used)

The shell.el has a concept of shell-chdrive-regexp which is used to detect
drive switching commands. However it seems that its use is not being fully
implemented. Kind of makes sense...people use emacs on Windows to get away
from Windows ;)

Sandip

"Sandip Chitale" <address@hidden> wrote in message
news:address@hidden
> Folks,
>
> Is there any way to make the file name completion correctly in a shell in
> Windows emacs?
>
> When I start (default) shell i.e. cmd.exe I get:
>
> Microsoft Windows XP [Version 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.
>
> c:\emacs\bin>ls e<tab>
>
> At this point if I attempt file name completion by hitting tab I get files
> in c:\emacs\bin.
>
> Now I change the drive:
>
> c:\emacs\bin>x:
>
> X:\>ls e<tab>
>
> At this point if I attempt file name completion by hitting tab I *still*
get
> files in c:\emacs\bin.
>
> Now if I do:
>
> X:\>cd x:\
>
> and then do:
>
> X:\>ls e<tab>
>
> At this point if I attempt file name completion by hitting tab I do get
> files from x:\
>
> I have correctly set the shell-chdrive-regexp variable.
>
> M-x shell-chdrive-regexp <RETURN> yields:
>
> shell-chdrive-regexp's value is "[a-zA-Z]:"
>
> Any ideas?
>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]