zsh: only set alias for emacsclient if it is installed

This commit is contained in:
tastytea 2022-07-31 23:10:05 +02:00
parent 8febf74ca9
commit b638b4d1ac
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM

View File

@ -122,7 +122,8 @@ fi
[[ ${COLORTERM} == *(truecolor|24bit)* ]] || zmodload zsh/nearcolor
# emacsclient 27 (TODO: check later versions) needs this for TrueColor
if [[ ${TERM#*-} == "256color" ]] \
if type emacsclient >& - \
&& [[ ${TERM#*-} == "256color" ]] \
&& [[ ${COLORTERM} == *(truecolor|24bit)* ]] \
&& [[ -f "/usr/share/terminfo/${TERM[1]}/${TERM%-*}-direct" ]]; then
alias $(command -v emacsclient)="TERM=${TERM%-*}-direct $(command -v emacsclient)"