Skip to content

Instantly share code, notes, and snippets.

@aturley
Created May 24, 2012 17:56
Show Gist options
  • Save aturley/2783129 to your computer and use it in GitHub Desktop.
Save aturley/2783129 to your computer and use it in GitHub Desktop.
emacsclient-like scripts for open files in remotely running emacs instances. Run remacsserver.sh on the machine running emacs (don't forget to start-server in emacs) and use remacsclient.sh FILENAME to open files. You need to have tramp set up in emacs, a
#/bin/bash
if [ -z "${EMACSCLIENT_HOST}" ]; then
echo "EMACSCLIENT_HOST is not set!"
exit 1
fi
FILENAME=$1
if [ -z "${FILENAME}" ]; then
echo "Please specify a file name."
exit 1
fi
FULL_FILENAME=$(pwd)/${FILENAME}
SELF_ADDRESS=$(ip addr show eth0 | grep 'inet ' | sed 's/.*inet \([^\/]*\).*/\1/')
echo "/$(whoami)@${SELF_ADDRESS}:${FULL_FILENAME}" | nc ${EMACSCLIENT_HOST} 9292
#!/bin/bash
while [ "1" == "1" ]; do
nc -l 9292 | xargs emacsclient -n
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment