diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2023-01-12 13:29:38 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2023-01-13 17:36:32 -0700 |
commit | 25de3ae596535fd46b6f745420cd1cdc2e72f09e (patch) | |
tree | d2bf20b81df0cf37a69a0f4555c744cdf3dce303 /bin/emacsclient | |
parent | ac8ac7d171c21793e6192b2424ed374ba86c175a (diff) | |
download | dotfiles-25de3ae596535fd46b6f745420cd1cdc2e72f09e.tar.gz |
emacsclient wrapper: handle --spw/* options when we give up early
Diffstat (limited to 'bin/emacsclient')
-rwxr-xr-x | bin/emacsclient | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/emacsclient b/bin/emacsclient index 8cb4b75b..c30b341a 100755 --- a/bin/emacsclient +++ b/bin/emacsclient @@ -44,8 +44,22 @@ installed_emacsclient="$(PATH=$(echo "$PATH" \ | sed -e "s#$HOME/src/dotfiles/bin:##") \ command -v emacsclient)" +defer () { + for arg do + shift + case "$arg" in + '--spw/installed') ;; + '--spw/no-start') may_start=false ;; + '--spw/'*) echo >&2 "emacsclient: cannot handle $arg"; exit 1 ;; + *) set -- "$@" "$arg" + esac + done + $may_start && set -- -a "" "$@" + exec "$installed_emacsclient" "$@" +} + for cmd in bash flock inotifywait perl pwdx ss; do - command -v $cmd >/dev/null || exec "$installed_emacsclient" -a "" "$@" + command -v $cmd >/dev/null || defer "$@" done [ -n "$BASH_VERSION" ] || exec bash "$0" "$@" |