I'm trying to use tabbar to setup groups for each remote host where I have buffers open. I need to get the full buffer name, so I can parse the hostname to set the group name.
I've figured out how to do everything I want, except for when using tramp and dired.
When I initially open /ssh:dev:/home/fandingo/, I get some strange values for dired-directory
and default-directory
:
(default-directory .
#("/ssh:fandingo@dev:/home/fandingo/" 5 12
(tramp-default t)))
(dired-directory .
#("/ssh:fandingo@dev:/home/fandingo/" 5 12
(tramp-default t)))
(I used M-x pp-eval-expression RET (buffer-local-variables) RET
to get this info.)
If I navigate to a directory within this buffer (say elisp/), these variables become "normal:"
(default-directory . "/ssh:fandingo@dev:/home/fandingo/elisp/")
(dired-directory . "/ssh:fandingo@dev:/home/fandingo/elisp/")
If I go up (..) to the original directory, things go back to the weird values.
What variable or function can I use to consistently get the full tramp path, regardless of whether I've navigated anywhere or not in the dired buffer?
Alternatively, how can I transparently handle both data structures to get the tramp path? I'm not sure I even understand what Emacs is returning in the originally visited directory (It's not a list, or at least I couldn't car
it.).
GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.16.6)
#("/ssh:fandingo@dev:/home/fandingo/" 5 12 (tramp-default t))
is how Emacs writes a string that has text properties. This is just the string"/ssh:fandingo@dev:/home/fandingo/"
, but with text propertytramp-default
with valuet
. You can use that string anywhere, as an ordinary string. This is just the way Emacs prints the value of a propertized string.