[Top][All Lists]

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

distinguish tramp from non-tramp buffer

From: Ernesto Alfonso
Subject: distinguish tramp from non-tramp buffer
Date: Thu, 9 Aug 2018 19:50:02 -0700


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.

I did an apropos search and found `tramp-current-method`, but this variable is not buffer-local.

I tried `tramp-mode`, but again, this is not buffer-local.

In my version of tramp,, only `tramp-temp-buffer-file-name` and `tramp-rfn-eshadow-overlay` are buffer-local, neither of which seem useful for my purpose.

Other than parsing the buffer-name, is there a good way to distinguish tramp from non-tramp buffers?

I also noticed on tramp buffers, buffer-name returns a list like:

    #("filename</sudo:address@hidden:>" 16 20 (tramp-default t))

Is this behavior documented and can I rely on it? In my build, the buffer-name doc says buffer-name should be a string:

    buffer-name is a built-in function in ‘C source code’.
    (buffer-name &optional BUFFER)
    Return the name of BUFFER, as a string.
    BUFFER defaults to the current buffer.
    Return nil if BUFFER has been killed.


reply via email to

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