Subject: bug#49229: 27.2; `M-x shell' fails over TRAMP from local MS Windows

From: Jim Porter <[email-masked]>
Date: Thu, 1 Jul 2021 10:07:53 -0700

(Hopefully I don't need to do anything special to comment on a closed bug...)

On Sun, Jun 27, 2021 at 11:18 PM Michael Albinus <[email-masked]> wrote:
>
> I've pushed the patch to master, closing the bug. The Tramp part of the
> patch will appear with Tramp 2.5.1 on GNU ELPA.

I discovered a minor issue with the Tramp part of the patch. On MS
Windows, if I'm editing a remote file and then open a local file, the
newly-opened local file's default directory doesn't have a volume
letter. This still works overall, but it does break the "~" file
alias.

Here are steps to reproduce:

  C-x C-f /sshx:server:/path/to/file.txt
  ;; "/sshx:server:/path/to/" is pre-filled here:
  C-x C-f /sshx:server:/path/to//~/local.txt
  ;; local.txt opens/saves correctly, but...
  C-x C-f
  ;; Initial value in minibuffer is "/Users/Jim/Documents/".
  ;; Before Tramp 2.5.1, it was "~/".

This might cause some problems in other places, but so far the only
issue I've found is the file alias for "~" no longer working. However,
the fact that `default-directory' for local.txt isn't an absolute path
could cause issues if we use that `default-directory' elsewhere. Since
"/Users/Jim/Documents/" is relative to the current drive, it can mean
different things depending on what Emacs thinks the current drive is
at the time.

Maybe it would be best to revert the Tramp part of this patch and do
something similar to the patch in my original message. That would
ensure that nothing unexpected happens as a result of
`default-directory' being relative to the current drive. If that makes
sense, I can put together a proper patch for the `M-x shell' part.