emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs syntax for filenames to mean "absolute location on the current


From: Michael Albinus
Subject: Re: Emacs syntax for filenames to mean "absolute location on the current remote host"?
Date: Tue, 29 Aug 2023 09:30:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Jim Porter <jporterbugs@gmail.com> writes:

Hi Jim,

> In Emacs, is there a way of spelling a file name to mean "an absolute
> name on the current remote host"? We have a way of spelling an
> absolute name on the local host ("/foo/bar"), and an absolute name on
> a specific remote ("/method:host:/foo/bar"), but I'm not aware of a
> way to make a string that means the equivalent of:
>
>   (concat (file-name-remote-p default-directory) "/foo/bar")
>
> Do we have a syntax for this? If not, could we add one? Maybe
> something like "/.::/foo/bar"? That would be a remote file name with
> the method of "." - i.e. "the current method" and no hostname (it
> would be inferred from the current remote).

Anything goes. However, if we go this way, I wouldn't mix this with
Tramp's remote file name syntax, and the respective file name
handler. We would need a new file name handler similar to
file-name-non-special, which would be activated via "/.:/foo/bar" (a
little bit shorter).

> If you'd like to know why I'm asking, read on. But be warned: I'm
> still trying to reason through all the logic here myself, so this may
> be a bit confusing (it certainly is for me!).
>
> This is relevant for Eshell. In Eshell, you SSH into other hosts
> simply by using "cd /ssh:user@host:~". This is very convenient, but it
> produces some odd effects: when you're on a remote host like this, the
> meaning of "/foo/bar" is ambiguous. If you pass that to a command, it
> could mean:
>
>   1) "/foo/bar" on your local filesystem (when the command is an Emacs
>   Lisp function)
>
>   2) "/foo/bar" on "host" (when the command is an external process)

Thinking about, it seems we need this *only* in Eshell. And then the
need isn't such obvious.

What if you declare, that in Eshell an absolute file name "/foo/bar" is
always on "host"? Then it doesn't matter, whether a user writes "cd /foo/bar"
or "*cd /foo/bar". This would cover most use cases in Eshell, and it is
simpler to type than "cd /.:/foo/bar".

In the few cases a user means the local absolute file name "/foo/bar",
she still can type "cd /:/foo/bar".

Best regards, Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]