Commit 357159ae597f

Vincent Demeester <vincent@sbr.pm>
2016-01-25 08:53:16
Add es too
1 parent 050bab4
Changed files (2)
bin/emacs
@@ -1,11 +0,0 @@
-#!/bin/sh
-# Run emacs using emacsclient with alternate-editor pointing on emacs-daemon
-
-ADDITIONAL_ARGS=""
-if test "$#" -eq 0; then
-    # Add a -c option if n
-    ADDITIONAL_ARGS="."
-fi
-
-# Launch it with dbus-launch to make sure notifications will work.. :D
-exec dbus-launch emacsclient --alternate-editor /usr/bin/emacs $ADDITIONAL_ARGS $@
bin/es
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# simple script to shutdown the running Emacs daemon
+
+# emacsclient options for reference
+# -a Alternate editor, runs bin/false in this case
+# -e eval the script
+
+# If the server-process is bound and the server is in a good state, then kill
+# the server
+
+server_ok() {
+  emacsclient -a "false" -e "(boundp 'server-process)"
+}
+
+if [ "t" == "$(server_ok)" ]; then
+  echo "Shutting down Emacs server"
+  # wasn't removing emacs from ALT-TAB on mac
+  # emacsclient -e "(server-force-delete)"
+  emacsclient -e '(kill-emacs)'
+else
+  echo "Emacs server not running"
+fi