emacsclient.sh 372 Bytes
Newer Older
1
2
#!/bin/sh

Tristan Carel's avatar
Comment    
Tristan Carel committed
3
# get list of available X windows.
4
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
Tristan Carel's avatar
Comment    
Tristan Carel committed
5

6
if [ -z "$x" ] ;then
Tristan Carel's avatar
Comment    
Tristan Carel committed
7
    # Create one if there is no X window yet.
Tristan Carel's avatar
Tristan Carel committed
8
    emacsclient --alternate-editor "" --create-frame "$@"
9
else
Tristan Carel's avatar
Tristan Carel committed
10
    # prevent creating another X frame if there is at least one present.
Tristan Carel's avatar
Tristan Carel committed
11
    emacsclient --alternate-editor "" "$@"
12
fi