Previous: , Up: Connecting to a remote lisp   [Contents][Index]


7.1.3 Setting up pathname translations

One of the main problems with running swank remotely is that Emacs assumes the files can be found using normal filenames. if we want things like slime-compile-and-load-file (C-c C-k) and slime-edit-definition (M-.) to work correctly we need to find a way to let our local Emacs refer to remote files.

There are, mainly, two ways to do this. The first is to mount, using NFS or similar, the remote machine’s hard disk on the local machine’s file system in such a fashion that a filename like /opt/project/source.lisp refers to the same file on both machines. Unfortunately NFS is usually slow, often buggy, and not always feasible, fortunately we have an ssh connection and Emacs’ tramp-mode can do the rest. (See See (tramp)TRAMP User Manual.)

What we do is teach Emacs how to take a filename on the remote machine and translate it into something that tramp can understand and access (and vice versa). Assuming the remote machine’s host name is remote.example.com, cl:machine-instance returns “remote” and we login as the user “user” we can use slime-tramp contrib to setup the proper translations by simply doing:

(add-to-list 'slime-filename-translations
             (slime-create-filename-translator
              :machine-instance "remote"
              :remote-host "remote.example.com"
              :username "user"))