From: Michael Albinus <michael.albinus@gmx.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: master f8b2a01a9e: * lisp/shell.el (shell): Query shell file name from `interactive`
Date: Sun, 29 May 2022 19:13:25 +0200 [thread overview]
Message-ID: <87leukw9ca.fsf@gmx.de> (raw)
In-Reply-To: <jwvmtf1czul.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 28 May 2022 13:58:35 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
Hi Stefan,
>>> Does the patch below look correct to you?
>>> It also tries to address the FIXME while we're at it.
>> I'm not sure. You use `buffer', and not `buf' for the interactive spec.
>
> Could you clarify what you mean by that?
>
> I check nullness of `buffer` so as to preserve the existing behavior
> where we prompt for the shell's directory only when current-prefix-arg
> is specified.
>
> And the interactive spec returns (list buffer ...) rather than (list
> buf ...) again so as to preserve the existing behavior (tho I don't
> think it would make any difference in practice other than the
> information it leaves in `command-history`).
>
>> OTOH, you set `default-directory' in `buf', which might cure it.
>
> Cure what?
I've tested the patch now, it looks correct.
>> Anyway, it would be an incompatible (but appreciated) change.
>
> What change are you referring to?
Forget it. I hoped, that if you re-use the *shell* buffer, which has an
exited shell, that this buffer would change it's default-directory to
the default-directory of the current buffer when the shell is
re-invoked. Something like this:
--8<---------------cut here---------------start------------->8---
M-x cd RET /tmp
M-x shell
; You're in the *shell* buffer, running the shell on your local host.
exit
; The *shell* buffer has exited the shell.
C-x b <the previous buffer>
M-x cd RET /ssh:remotehost:/tmp
M-x shell
; The *shell* buffer shall be remote now.
--8<---------------cut here---------------end--------------->8---
But this didn't happen :-(
>> If you have an existing shell buffer, it would be reused as-it-is, and
>> you cannot change its remoteness. Something, which has been plagued me
>> since ever.
>
> Hmm... I don't understand. AFAICT both with my new code and with the
> existing code `C-u M-x shell` will prompt for the shell's directory if
> it's done from within (and "to") a shell buffer with remote
> default-directory, no?
I'm speaking about reusing an existing *shell* buffer, and invoking M-x
shell w/o a prefix. It would be helpful, if there could be an
interaction when the remoteness of default-directory of the current and
the *shell* buffer don't match.
>> Hmm, do we have test cases for this, for both the local and the remote
>> case, for both an existing and a new shell buffer?
>
> AFAICT we don't (we have rather few tests in `shell-tests.el`).
>
>> (If not, I could volunteer to write them, but it might take some
>> days then.)
>
> That would be very appreciated.
I'll see what can be done.
> Stefan
Best regards, Michael.
next prev parent reply other threads:[~2022-05-29 17:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <165365729037.13166.16983049289085077158@vcs2.savannah.gnu.org>
[not found] ` <20220527131450.B347BC01683@vcs2.savannah.gnu.org>
2022-05-28 9:19 ` master f8b2a01a9e: * lisp/shell.el (shell): Query shell file name from `interactive` Michael Albinus
2022-05-28 14:12 ` Stefan Monnier
2022-05-28 15:31 ` Stefan Monnier
2022-05-28 16:18 ` Michael Albinus
2022-05-28 17:58 ` Stefan Monnier
2022-05-29 17:13 ` Michael Albinus [this message]
2022-05-29 17:38 ` Stefan Monnier
2022-05-29 19:08 ` Michael Albinus
2022-05-29 20:46 ` Stefan Monnier
2022-05-28 13:35 ` Lars Ingebrigtsen
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=87leukw9ca.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.