# FILE: ~/.zshrc
# Open in Terminal
alias e='emacsclient --alternate-editor="" --tty'
# FILE: ~/.bin/ec
# Open file in Emacs existing Frame, otherwise create a new frame
#!/usr/bin/env bash
framelist=`emacsclient -a '' --eval '(frame-list)' 2>/dev/null | grep -o '#<frame'`
if [ "$(echo "$framelist" | sed -n '$=')" -ge 2 ]; then
# if a frame already exist
emacsclient --alternate-editor="" --no-wait "$@"
else
# create one if there is no frame yet
emacsclient --alternate-editor="" --create-frame --no-wait "$@"
fi