Emacs - standby test to determine the name / address of a remote server

Is there a test to get the name of the remote server (for example localhost) or the address (for example 12.34.56.789) in current-bufferwith dired-modeactive?

I suppose that I could use string-matchor split-string, and then equal, but I thought it might be a convenient function, for example, to get the server name.

iphone - dired-directory

/ssh:root@localhost#2222:/var/mobile/Applications/F30B1574-5979-4764-8742-7F9DB2863094/Documents/.0.data:

shared server - dired-directory

/ssh:lawlist@12.34.56.789:/home/lawlist/public_html:
+3
source share
1 answer

If you are interested in tram lines, then you probably want to see tramp-dissect-file-nameor with-parsed-tramp-file-name. eg:.

(tramp-file-name-host (tramp-dissect-file-name path))

, tramp-file-name-real-host.

file-remote-p, ; , :

(file-remote-p path 'host)

( ),

+5

All Articles