From: Michael Albinus <michael.albinus@gmx.de>
To: Manuel Giraud <manuel@ledu-giraud.fr>
Cc: 60968@debbugs.gnu.org
Subject: bug#60968: 30.0.50; M-x shell keeps an old default-directory
Date: Fri, 20 Jan 2023 20:00:46 +0100 [thread overview]
Message-ID: <87sfg5t4ip.fsf@gmx.de> (raw)
In-Reply-To: <87tu0l3vdb.fsf@ledu-giraud.fr> (Manuel Giraud's message of "Fri, 20 Jan 2023 19:37:36 +0100")
Manuel Giraud <manuel@ledu-giraud.fr> writes:
Hi Manuel,
> Here is an annoyance I bump into sometimes. Recipe:
>
> C-x C-f /-:somewhere-remote:
> M-x shell ;; Emacs asks me about the remote shell and that is not
> ;; what I want
> C-g
> C-x C-f somewhere-local
> M-x shell ;; Emacs still asks me about the previous remote shell
>
> It seems to come from the fact that when in shell.el line 865 the
> "*shell*" buffer is already created and its default-directory set… Or
> maybe, I'm just doing it wrong when I want a shell.
This is the specified behavior of the `shell' command. From the
docstring:
--8<---------------cut here---------------start------------->8---
If BUFFER exists but shell process is not running, make new shell.
If BUFFER exists and shell process is running, just switch to BUFFER.
--8<---------------cut here---------------end--------------->8---
That is, the shell buffer is reused, even if you have interrupted with
C-g, and the shell didn't start yet. And so its default-directory.
If you want another buffer (and another shell therefore), the following
from the docstring is relevant:
--8<---------------cut here---------------start------------->8---
Interactively, a prefix arg means to prompt for BUFFER.
--8<---------------cut here---------------end--------------->8---
So your use case needs "C-u M-x shell". Or you delete the shell buffer
after you have interrupted with C-g.
Best regards, Michael.
next prev parent reply other threads:[~2023-01-20 19:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 18:37 bug#60968: 30.0.50; M-x shell keeps an old default-directory Manuel Giraud
2023-01-20 19:00 ` Michael Albinus [this message]
2023-01-20 20:03 ` Manuel Giraud
2023-01-21 8:49 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sfg5t4ip.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=60968@debbugs.gnu.org \
--cc=manuel@ledu-giraud.fr \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.