diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2023-01-13 09:32:15 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2023-01-13 17:36:32 -0700 |
commit | 6c4423c737d9afdbb6db3c7eb1c795d0277ce465 (patch) | |
tree | 7cfe32c47ebe1ebdbae5f330399704718392baf2 /bin/emacsclient | |
parent | a4c3b8b53f2799ba78ae24016b2deafaa03b2ded (diff) | |
download | dotfiles-6c4423c737d9afdbb6db3c7eb1c795d0277ce465.tar.gz |
emacsclient wrapper: use 'exec -a' when giving up and have bash
Also, reexecute with bash first to avoid checking the other commands twice.
Diffstat (limited to 'bin/emacsclient')
-rwxr-xr-x | bin/emacsclient | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/bin/emacsclient b/bin/emacsclient index 12630575..b980860b 100755 --- a/bin/emacsclient +++ b/bin/emacsclient @@ -55,13 +55,18 @@ defer () { esac done $may_start && set -- -a "" "$@" - exec "$installed_emacsclient" "$@" + if [ -n "$BASH_VERSION" ]; then + exec -a emacsclient "$installed_emacsclient" "$@" + else + exec "$installed_emacsclient" "$@" + fi } -for cmd in bash flock inotifywait perl pwdx ss; do +[ -n "$BASH_VERSION" ] \ + || { command -v bash >/dev/null && exec bash "$0" "$@" || defer "$@"; } +for cmd in flock inotifywait perl pwdx ss; do command -v $cmd >/dev/null || defer "$@" done -[ -n "$BASH_VERSION" ] || exec bash "$0" "$@" # We have to do this to break up clustered short options. An unfortunate # consequence is maintaining a copy of all of emacsclient(1)'s long opts here. |