Jim Porter writes: Hi Jim, >> I've pushed a fix to the master branches of Emacs and Tramp. Could you, >> pls, check? > > I tested on MS Windows and it works correctly for me. (Note that I > just copied and eval'ed the new version of `tramp-file-name-handler', > since I don't have a proper build environment on MS Windows.) Thanks for confirmation. > If I erase the default text and instead enter > "C:/Windows/System32/cmd.exe" into the `M-x shell' prompt, it treats > *that* as a remote path too. Now, the prompt does say to enter a > *remote* shell path, so if I enter a local path, I made a mistake. > However, the default shell path for `M-x shell' from a remote > directory is a TRAMP path ("/sshx:server:/path/to/some//bin/sh"), so > it's surprising that when I delete the TRAMP host prefix, I still end > up running a shell on the remote server. `read-file-name' as used in `shell' just reads a file name, no matter whether a local or remote one. > Perhaps it would be nicer if, when `M-x shell' prompted for the remote > shell path, it didn't include the TRAMP prefix by default (e.g. the > default value would just be "/bin/sh"). That might not interact well > with `read-file-name' completion though; is it possible to use > file-name completion on a remote path without the TRAMP prefix? No, that doesn't work. File name completion and alike wouldn't work any more. But we could teach `read-file-name' to accept only remote file names. What about this patch: