summaryrefslogtreecommitdiff
path: root/plugins/emacs/emacsclient.sh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/emacs/emacsclient.sh')
-rwxr-xr-xplugins/emacs/emacsclient.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh
new file mode 100755
index 000000000..38d419813
--- /dev/null
+++ b/plugins/emacs/emacsclient.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# get list of available X windows.
+x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
+
+if [ -z "$x" ] ;then
+ # Create one if there is no X window yet.
+ emacsclient --alternate-editor "" --create-frame "$@"
+else
+ # prevent creating another X frame if there is at least one present.
+ emacsclient --alternate-editor "" "$@"
+fi