* [gentoo-commits] emacs r1564 - emacs-daemon
@ 2010-09-18 20:10 Ulrich Mueller (ulm)
0 siblings, 0 replies; only message in thread
From: Ulrich Mueller (ulm) @ 2010-09-18 20:10 UTC (permalink / raw
To: gentoo-commits
Author: ulm
Date: 2010-09-18 20:10:51 +0000 (Sat, 18 Sep 2010)
New Revision: 1564
Added:
emacs-daemon/emacs-stop.sh
Modified:
emacs-daemon/ChangeLog
emacs-daemon/Makefile
emacs-daemon/emacs.rc
Log:
Export some variables before calling the stop script, bug 337829.
Add an example stop script.
Modified: emacs-daemon/ChangeLog
===================================================================
--- emacs-daemon/ChangeLog 2010-09-18 15:56:55 UTC (rev 1563)
+++ emacs-daemon/ChangeLog 2010-09-18 20:10:51 UTC (rev 1564)
@@ -1,3 +1,10 @@
+2010-09-18 Ulrich Mueller <ulm@gentoo.org>
+
+ * emacs.rc (stop): Output ebegin/eend messages. Export some
+ variables before calling the stop script, bug 337829.
+ * emacs-stop.sh: New file, example stop script.
+ * Makefile (DISTFILES): Add emacs-stop.sh.
+
2009-11-20 Ulrich Mueller <ulm@gentoo.org>
* Version 0.17 released.
Modified: emacs-daemon/Makefile
===================================================================
--- emacs-daemon/Makefile 2010-09-18 15:56:55 UTC (rev 1563)
+++ emacs-daemon/Makefile 2010-09-18 20:10:51 UTC (rev 1564)
@@ -8,7 +8,7 @@
P = $(PN)-$(PV)
DISTFILES = README ChangeLog emacs.rc emacs.conf emacs-wrapper.sh \
- 10emacs-daemon-gentoo.el
+ emacs-stop.sh 10emacs-daemon-gentoo.el
.PHONY: all dist clean
Added: emacs-daemon/emacs-stop.sh
===================================================================
--- emacs-daemon/emacs-stop.sh (rev 0)
+++ emacs-daemon/emacs-stop.sh 2010-09-18 20:10:51 UTC (rev 1564)
@@ -0,0 +1,23 @@
+#!/bin/bash
+# Copyright 2008-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2 or later
+# $Id$
+
+EMACS_LISP_EXPR="(kill-emacs)"
+
+su "${USER}" -c "emacsclient --eval \"${EMACS_LISP_EXPR}\"" \
+ </dev/null &>/dev/null &
+pid=$!
+
+# Wait for emacsclient
+for (( t=${EMACS_TIMEOUT:-30}; t > 0; t-- )); do
+ sleep 1
+ kill -0 ${pid} 2>/dev/null || exit 0
+done
+
+echo "${0##*/}: timeout waiting for emacsclient" >&2
+kill ${pid} 2>/dev/null
+
+# exit 0: runscript shall stop the emacs process
+# exit 1: runscript shall exit with an error
+exit 0
Property changes on: emacs-daemon/emacs-stop.sh
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Modified: emacs-daemon/emacs.rc
===================================================================
--- emacs-daemon/emacs.rc 2010-09-18 15:56:55 UTC (rev 1563)
+++ emacs-daemon/emacs.rc 2010-09-18 20:10:51 UTC (rev 1564)
@@ -71,7 +71,10 @@
stop() {
# Optionally, call a custom script before stopping.
if [ "${EMACS_STOP}" ] && [ -x "${EMACS_STOP}" ]; then
- "${EMACS_STOP}" || return
+ export USER PIDFILE EMACS EMACS_TIMEOUT EMACS_DEBUG
+ ebegin "Calling Emacs stop script for ${USER}"
+ "${EMACS_STOP}"
+ eend $? || return
fi
ebegin "Stopping Emacs daemon for user ${USER}"
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-09-18 20:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-18 20:10 [gentoo-commits] emacs r1564 - emacs-daemon Ulrich Mueller (ulm)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox