summaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
Diffstat (limited to 'assets')
-rwxr-xr-xassets/emacsd30
1 files changed, 30 insertions, 0 deletions
diff --git a/assets/emacsd b/assets/emacsd
new file mode 100755
index 0000000..cfb3af9
--- /dev/null
+++ b/assets/emacsd
@@ -0,0 +1,30 @@
+#!/bin/sh
+# Craig Jennings <c@cjennings.net>
+# allows emacs client to be launched as a service
+
+# PROVIDE: emacsd
+# REQUIRE: login # after login
+
+# Emacs daemon
+. /etc/rc.subr
+
+name="emacsd"
+rcvar=emacsd_enable
+start_cmd="${name}_start"
+stop_cmd="${name}_stop"
+load_rc_config $name
+: ${emacsd_enable:=no}
+: ${_msg="Emacs daemon started."}
+: ${emacsd_user:=cjennings}
+
+
+emacsd_start()
+{
+ su ${emacsd_user} -c " /usr/local/bin/emacs --daemon -u ${emacsd_user}"
+}
+emacsd_stop()
+{
+ su ${emacsd_user} -c "/usr/local/bin/emacsclient --eval \"(kill-emacs)\""
+}
+run_rc_command "$1"
+