eshell at server directory

Here is a little Emacs-macro that creates an eshell buffer with current directory set to a server directory path.

 1(defmacro srv-eshell (server-nick path )
 2  `(defun ,(intern (concat server-nick "-eshell")) ()
 3       (interactive)
 4     (let* ((eshell-buffer-name ,(concat server-nick "-eshell"))
 5	    (eshell-buffer   (eshell)))
 6
 7       )
 8     (end-of-buffer)
 9     (eshell-kill-input)
10     (insert ,(concat  "cd " path))
11     (eshell-send-input))
12    )

Use the macro like this:

1(srv-eshell "afws" "/scp:joakim@192.168.201.58:")

Now you get an interactive function you can call with m-x afws-eshell. This will open an eshell buffer called afws-eshell, with the current directory set to /scp:joakim@192.168.201.58: .

Tramp will sort out the rest.