[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master f8b2a01a9e: * lisp/shell.el (shell): Query shell file name fr
From: |
Michael Albinus |
Subject: |
Re: master f8b2a01a9e: * lisp/shell.el (shell): Query shell file name from `interactive` |
Date: |
Sun, 29 May 2022 19:13:25 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
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.
- Re: master f8b2a01a9e: * lisp/shell.el (shell): Query shell file name from `interactive`, Michael Albinus, 2022/05/28
- Re: master f8b2a01a9e: * lisp/shell.el (shell): Query shell file name from `interactive`, Stefan Monnier, 2022/05/28
- Re: master f8b2a01a9e: * lisp/shell.el (shell): Query shell file name from `interactive`, Stefan Monnier, 2022/05/28
- Re: master f8b2a01a9e: * lisp/shell.el (shell): Query shell file name from `interactive`, Michael Albinus, 2022/05/28
- Re: master f8b2a01a9e: * lisp/shell.el (shell): Query shell file name from `interactive`, Stefan Monnier, 2022/05/28
- Re: master f8b2a01a9e: * lisp/shell.el (shell): Query shell file name from `interactive`,
Michael Albinus <=
- Re: master f8b2a01a9e: * lisp/shell.el (shell): Query shell file name from `interactive`, Stefan Monnier, 2022/05/29
- Re: master f8b2a01a9e: * lisp/shell.el (shell): Query shell file name from `interactive`, Michael Albinus, 2022/05/29
- Re: master f8b2a01a9e: * lisp/shell.el (shell): Query shell file name from `interactive`, Stefan Monnier, 2022/05/29