Can emacs be launched using the remote configuration file?

I have different .emacs configuration files for working on servers where I work for different companies. These are packages that for various reasons do not want to be stored locally on my machine. Is there a way to start emacs using one of these remote directories, as if it were local?

Tramp is great for editing deleted files as if they were local - now I would like to be able to run the entire emacs editor in the same way.

+6
emacs tramp
source share
3 answers

run emacs using one of these remote directories as if it were local

If the servers are unix / linux servers and you have ssh access, you can try the SSH file system . Then you can connect the servers to local directories, for example:

> sshfs server1: ~/remote/server1 > sshfs server2: ~/remote/server2 

Then you can start emacs with emacs --no-init-file --load ~/remote/servers2/.emacs , etc.

which for various reasons do not want to be stored locally

If the packages are installed on .emacs.d on remote computers, you can create scripts on your computer such as the following:

 ;; .emacs.server1.el (add-to-list 'load-path (expand-file-name "~/remote/server1/.emacs.d")) (add-to-list 'load-path (expand-file-name "~/remote/server1/.emacs.d/package1")) (load (expand-file-name "~/remote/server1/.emacs")) 

And then run emacs as follows: emacs --no-init-file --load ~/.emacs.server1.el

Obviously, this script depends on the mounts listed above.

+3
source share

Out of curiosity, I simply gave this:

 emacs -q --load "/ssh: USER@HOSTNAME :.emacs.d/init.el" 

This worked, however, remote init.el sets the boot paths, such as "~ / .emacs.d / vendor /", so in fact the initialization file should know that the paths and file names must be relatively common. This base can be set by a shared variable, so try:

 emacs -q --eval '(setq init-base "/ssh: USER@HOSTNAME :") (load (concat init-base ".emacs.d/init.el"))' 

Then, in the remote configuration, add the init-base to any path or file name that it installs, which should be deleted.

+5
source share

You may find the SO question. Initial editing of a remote file using emacs tramp from an ssh session requires a solution to the related problem. Perhaps the answers there may give you what you want, namely, you can connect to emacs running on a remote machine.

+2
source share

All Articles