1
0
Fork 0

remove emacsremote script

last checked in thing in ~/bin/
This commit is contained in:
tastytea 2024-01-04 04:25:03 +01:00
parent e23594f3a6
commit 65d5b4fbf0
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
1 changed files with 0 additions and 47 deletions

View File

@ -1,47 +0,0 @@
#!/bin/bash
# Open file on a remote Emacs server.
# https://andy.wordpress.com/2013/01/03/automatic-emacsclient/ with added sudo.
params=()
sudo=0
local=0
for p in "${@}"; do
if [[ "${p}" == "-n" ]]; then
params+=( "${p}" )
elif [[ "${p}" == "-c" ]]; then
params+=( "${p}" )
elif [[ "${p}" == "-cn" ]]; then
params+=( "${p}" )
elif [[ "${p:0:1}" == "+" ]]; then
params+=( "${p}" )
elif [[ "${p}" == "--sudo" ]]; then
sudo=1
elif [[ "${p}" == "--local" ]]; then
# Use local server, for use with --sudo.
local=1
else
# Setting field separator to newline so that filenames with spaces will
# not be split up into 2 array elements.
OLDIFS=${IFS}
IFS=$'\n'
if [[ $(id -u) -eq 0 || ${sudo} -eq 1 ]]; then
if [[ ${local} -eq 0 ]]; then
params+=( "/ssh:$(hostname -f)|sudo:$(hostname -f):"$(realpath -m "${p}") )
else
params+=( "/sudo:localhost:"$(realpath -m "${p}") )
fi
else
params+=( "/ssh:$(hostname -f):"$(realpath "${p}") )
fi
IFS=${OLDIFS}
fi
done
emacsclient_tcp=""
if [[ -f "${HOME}/.emacs.d/server/server" ]]; then
emacsclient_tcp="-f ~/.emacs.d/server/server"
fi
emacsclient ${emacsclient_tcp} "${params[@]}"