Emacs — dired-mode test to determine remote server name / address

Is there a test to obtain the remote server name (e.g., localhost) or address (e.g., 12.34.56.789) in the current-buffer with dired-mode active?

I suppose I could use string-match or split-string and then equal, but I thought there might be a handy function like get 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:

Answers


If it's tramp paths you're interested in, then you probably want to look at tramp-dissect-file-name or with-parsed-tramp-file-name. e.g.:

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

If you want to exclude the port, use tramp-file-name-real-host.

You might need to check file-remote-p first, if that's not already certain; and that also leads us to a nice shortcut I'd never noticed before:

(file-remote-p path 'host)

(no port-less option here, if would seem)


Need Your Help

Multinode Hadoop slave nodes cannot access a jar file on the master node

hadoop jar hadoop-streaming

I'm using streaming to call a jar file to perform some tasks, as:

Jquery Mobile + Phonegap Android - Custom Buttons on bottom

android layout cordova jquery-mobile

I'm developing my first app in jquery mobile and phonegap. Using listview to populate my page with RSS feeds. Now i want to add custom buttons which lie at the bottom of my screen.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.