unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Dan McCarthy <daniel.c.mccarthy@gmail.com>
Cc: 53927@debbugs.gnu.org
Subject: bug#53927: 27.2; shell-mode dir tracking falls out of sync after popd in remote buffers
Date: Tue, 15 Feb 2022 14:39:37 +0100	[thread overview]
Message-ID: <87y22cw8o6.fsf@gmx.de> (raw)
In-Reply-To: <CAAoRiOVkNYqHBZvtCH3SMJfHTDtYhMV1WwbjxVxWZ0PTRQRHaA@mail.gmail.com> (Dan McCarthy's message of "Thu, 10 Feb 2022 15:18:46 -0500")

[-- Attachment #1: Type: text/plain, Size: 917 bytes --]

Dan McCarthy <daniel.c.mccarthy@gmail.com> writes:

Hi Dan,

> Create a remote shell-mode buffer with C-u M-x shell, using bash as
> the
> remote shell. pushd into another directory, then popd
> back. default-directory and shell-dirstack still have the other
> directory even though the popd took effect in the remote process.
>
> The problem seems to be that shell-prefixed-directory-name returns a
> string like
> "/ssh:dan@solstice:/ssh:dan@solstice:/home/dan/Documents/",
> doubling the remote prefix.
>
> Local shell-mode buffers do not have the problem.

Thanks for the bug report, I could reproduce it locally. The appended
patch fixes this for me, could you please check?

Eli, it is a very simple patch. Any chance to commit it to the emacs-28
branch? Otherwise, I would commit it to master, but we need a marker to
merge it back to the emacs-28 branch after the Emacs 28.1 release.

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 489 bytes --]

diff --git a/lisp/shell.el b/lisp/shell.el
index c0a82bca18..6198214abe 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -942,7 +942,7 @@ shell-prefixed-directory-name
       dir
     (if (file-name-absolute-p dir)
 	;; The name is absolute, so prepend the prefix.
-	(concat comint-file-name-prefix dir)
+	(concat comint-file-name-prefix (file-local-name dir))
       ;; For relative name we assume default-directory already has the prefix.
       (expand-file-name dir))))


  reply	other threads:[~2022-02-15 13:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 20:18 bug#53927: 27.2; shell-mode dir tracking falls out of sync after popd in remote buffers Dan McCarthy
2022-02-15 13:39 ` Michael Albinus [this message]
2022-02-15 15:29   ` Dan McCarthy
2022-02-15 16:41   ` Eli Zaretskii
2022-02-15 17:19     ` Michael Albinus

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=87y22cw8o6.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=53927@debbugs.gnu.org \
    --cc=daniel.c.mccarthy@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).