Node:Working Remotely



Working Remotely

When you work on project that involve a lot of programmers, it is generally the case that you will edit the files on your own machine, but you want to compile, run and debug your application in another buffer.

Fortunately, here too Emacs provides a very convenient way to do this.

Remote editing

First of all, the files do not need to be on your machine. Emacs can edit any remote file, by doing transparent FTP sessions between your machine and the remote machine that stores your files. This is a special Emacs mode, called ange-ftp. To use it, you just have to use a slightly different syntax when you open a file.

For instance, if you want to  open the file /work/foo.adb on the machine
aleph.gnu.org, where you log in as qwe, you would simply do this:

<C-x C-f> /qwe@aleph.gnu.org:/work/foo.adb <Return>

i.e put your name, the name of the machine and the name of the file.

The first time, Emacs will ask you for a password that it will remember until you close the current Emacs. Even if the ftp session times out, you won't need to reenter your password.

Every time you save the file, Emacs will upload it to the remote machine transparently. No file is modified on the local machine.

Remote compiling

If the machine you want to compile on is not the one your Emacs is running on, you can set the variable remote_machine in the project file for your application.

This will force Emacs to issue a rsh command for the compilation, instead of running it on the local machine. Unfortunately, this won't work on Windows workstations, since this protocol is not supported.

If  your   remote_machine  is  aleph.gnu.org   and  the  standard
compilation command is cd /work/ && gnatmake foo, then Emacs will
actually  issue  the  command  rsh  aleph.gnu.org  'cd  /work/  &&
gnatmake foo'.

The advantage of using the remote_machine variable is that it is easier to change that machine without having to modify the compilation command.

Note that if you need to set up some environment variables before the compilation, you need to insert a call to the appropriate initialization script in the compilation command, for instance:

build_cmd= initialization_script ; cd /work/ && gnatmake foo

Remote running and debugging

This feature is not completely implemented yet.

However, most of the time, you will be able to run your application remotely simply by replacing it with a 'rsh' call on Unix.

For instance, if your command was '${main}', you could replace it with
'rsh aleph.gnu.org ${main}'.

However, this would not fully work for instance on vxworks, where rsh is not supported.

Table of Contents