Ultimately I want the call the elisp (find-file "/abs/olute/file.name")
when (file-remote-p default-directory)
is non-nil and have the remote host applied to the absolute file name in the find-file call.
The actual use-case: I have a shell-mode session on a remote host where default-directory
is of the form "/meth:user@host:/abs/path/"
. I have added a command in shell mode that opens a file in a new buffer. If I send a relative file name the remote file is opened properly; if I send an absolute file path (starts with "/" or "~") it is evaluated relative to my local context rather than the remote.
I can wrap the function so that the remote info is tacked in front of the absolute file path before it's opened but I was wondering if there is a TRAMP function or variable that I can use to force the use of the remote host for absolute file paths. Note, again, that relative paths are handled appropriately by applying the remote host and path from default-directory correctly.
There is not such a Tramp function.
(find-file "/abs/olute/file.name")
knows, that the file name is a local one, and it doesn't call Tramp.So you must implement this on your own, indeed.