Condense emacsclient shell script a little

This commit is contained in:
TEC 2021-01-04 00:26:45 +08:00
parent 77624f4e38
commit 6b5d3c6cfd
Signed by: tec
GPG Key ID: 779591AFDB81F06C
1 changed files with 5 additions and 10 deletions

View File

@ -1031,21 +1031,16 @@ if [ -z "$DISPLAY" ] || $force_tty; then
# detect terminals with sneaky 24-bit support
if { [ "$COLORTERM" = truecolor ] || [ "$COLORTERM" = 24bit ]; } && [ $(tput colors 2>/dev/null) -lt 257 ]; then
if echo "$TERM" | grep -q "^\w\+-[0-9]"; then
termstub="${TERM%%-*}"
else
termstub="${TERM#*-}"
fi
termstub="${TERM%%-*}"; else
termstub="${TERM#*-}"; fi
if infocmp "$termstub-direct" >/dev/null 2>&1; then
TERM="$termstub-direct"
else
TERM="xterm-direct" # should be fairly safe
fi
TERM="$termstub-direct"; else
TERM="xterm-direct"; fi # should be fairly safe
fi
emacsclient --tty -create-frame --alternate-editor="" "${args[@]}"
else
if ! $force_wait; then
args+=(--no-wait)
fi
args+=(--no-wait); fi
emacsclient -create-frame --alternate-editor="" "${args[@]}"
fi
#+end_src