Created
March 2, 2011 11:28
-
-
Save akheron/850795 to your computer and use it in GitHub Desktop.
Use emacsclient for editing remote files by setting this script as EDITOR in the remote machine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Use this script as your EDITOR to allow editing remote files with emacsclient. | |
# Works by connecting to the Emacs machine with SSH and using a suitable tramp prefix. | |
# How to reach this machine from the one that's running Emacs | |
ME=user@remote-host | |
# How to reach the machine that's running Emacs from this machine | |
THEY=user@host-running-emacs | |
if [ "${1#/}" != "$1" ]; then | |
# absolute path | |
exec ssh $THEY "emacsclient /$ME:$1" | |
else | |
# relative path | |
PWD=$(pwd) | |
exec ssh $THEY "emacsclient /$ME:$PWD/$1" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment