|
From: | Ernesto Alfonso |
Subject: | Re: distinguish tramp from non-tramp buffer |
Date: | Fri, 10 Aug 2018 09:51:38 -0700 |
Ernesto Alfonso <address@hidden> writes:
> Hi,
Hi Ernesto,
> I'm not too familiar with tramp internals and I was looking for a way
> to easily determine whether a given buffer is using tramp or not, and
> optionally to determine the method in use.
The buffer-local variable `default-directory' will help. It gives always
the default directory of a buffer, independent whether a file is visiting
this buffer or not.
If (file-remote-p default-directory) returns non-nil, the buffer is
related to Tramp. Even better, (file-remote-p default-directory 'method)
returns the connection method.
> Thanks,
>
> Ernesto
Best regards, Michael.
[Prev in Thread] | Current Thread | [Next in Thread] |