[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: distinguish tramp from non-tramp buffer
From: |
Michael Albinus |
Subject: |
Re: distinguish tramp from non-tramp buffer |
Date: |
Fri, 10 Aug 2018 15:04:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
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.