unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Sandip Chitale" <sandipchitale@fairisaac.com>
Subject: Re: file name Completion in Shell (cmd.exe) on Emacs (MS Windows)
Date: Wed, 21 Jul 2004 10:47:14 -0700	[thread overview]
Message-ID: <40feac24$0$66471$14726298@news.sunsite.dk> (raw)
In-Reply-To: 40fc38f9$0$23869$14726298@news.sunsite.dk

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" <sandipchitale@fairisaac.com> wrote in message
news:40fc38f9$0$23869$14726298@news.sunsite.dk...
> 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?
>
>

  parent reply	other threads:[~2004-07-21 17:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-19 21:11 file name Completion in Shell (cmd.exe) on Emacs (MS Windows) Sandip Chitale
2004-07-20  6:00 ` Carsten Weinberg
2004-07-20  9:43 ` Mathias Dahl
2004-07-20 17:08   ` Sandip Chitale
2004-07-21  9:36     ` Mathias Dahl
     [not found] ` <mailman.685.1090303150.1960.help-gnu-emacs@gnu.org>
2004-07-20 17:07   ` Sandip Chitale
2004-07-21 17:47 ` Sandip Chitale [this message]
2004-07-21 19:03   ` FCC
2004-07-23  8:46   ` martin
2004-07-23 16:51     ` Sandip Chitale
2004-07-22  3:54 ` Bruce Ingalls
2004-07-22 17:24   ` Sandip Chitale

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='40feac24$0$66471$14726298@news.sunsite.dk' \
    --to=sandipchitale@fairisaac.com \
    /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.
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).