public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/emacs-tools:emacs-common commit in: /
Date: Sun, 09 Mar 2025 20:47:56 +0000 (UTC)	[thread overview]
Message-ID: <1741549478.88623eaf009738afd30693093a3b1d9abf00a858.ulm@gentoo> (raw)

commit:     88623eaf009738afd30693093a3b1d9abf00a858
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  9 19:44:38 2025 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sun Mar  9 19:44:38 2025 +0000
URL:        https://gitweb.gentoo.org/proj/emacs-tools.git/commit/?id=88623eaf

Add wrapper script for Emacs daemon

* emacs-wrapper.sh: New file, moved here from emacs-daemon.
* 10emacs-common-gentoo.el: Ditto. Simplified.
* Makefile (DISTFILES): Add them.
* emacs.initd (EMACS_START, EMACS_SIGNAL_TIMEOUT): New variables.
* README.daemon: Document them.

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 10emacs-common-gentoo.el | 3 +++
 ChangeLog                | 8 ++++++++
 Makefile                 | 3 ++-
 README.daemon            | 9 +++++++++
 emacs-wrapper.sh         | 3 +++
 emacs.initd              | 7 ++++++-
 6 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/10emacs-common-gentoo.el b/10emacs-common-gentoo.el
new file mode 100644
index 0000000..b23135e
--- /dev/null
+++ b/10emacs-common-gentoo.el
@@ -0,0 +1,3 @@
+(if (daemonp)
+    ;; Restart the server if signal SIGUSR1 is received
+    (define-key special-event-map [sigusr1] #'server-start))

diff --git a/ChangeLog b/ChangeLog
index 9bd5053..dabba3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-03-09  Ulrich Müller  <ulm@gentoo.org>
+
+	* emacs-wrapper.sh: New file, moved here from emacs-daemon.
+	* 10emacs-common-gentoo.el: Ditto. Simplified.
+	* Makefile (DISTFILES): Add them.
+	* emacs.initd (EMACS_START, EMACS_SIGNAL_TIMEOUT): New variables.
+	* README.daemon: Document them.
+
 2025-03-07  Ulrich Müller  <ulm@gentoo.org>
 
 	* README.gentoo.in: New file, from DOC_CONTENTS of the ebuild.

diff --git a/Makefile b/Makefile
index 76a2498..bedfc9f 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,8 @@ ICONFILES = sink.png \
 	emacs25_128.png emacs25.svg
 GSCHEMAFILES = org.gnu.emacs.defaults.gschema.xml
 DISTFILES = README.gentoo.in README.daemon \
-	site-start.el site-gentoo.el subdirs.el.in emacs.initd \
+	site-start.el site-gentoo.el subdirs.el.in 10emacs-common-gentoo.el \
+	emacs.initd emacs-wrapper.sh \
 	$(DESKTOPFILES) $(addprefix icons/,COPYRIGHT.icons $(ICONFILES)) \
 	$(GSCHEMAFILES)
 

diff --git a/README.daemon b/README.daemon
index 12201dc..a7a9e49 100644
--- a/README.daemon
+++ b/README.daemon
@@ -39,6 +39,15 @@ directory. The following variables can the configured:
    Options to pass to Emacs (in addition to ``--fg-daemon`` which is
    always passed); empty by default.
 
+``EMACS_START``
+   Wrapper script for starting Emacs. This executes a login shell,
+   in order to read the user's profile (bug #246460);
+   ``/usr/libexec/emacs/emacs-wrapper.sh`` by default.
+
+``EMACS_SIGNAL_TIMEOUT``
+   Retry specification for stopping the daemon; ``TERM/30/KILL/5``
+   by default. See start-stop-daemon(8) for documentation.
+
 Launching the Emacs daemon at system startup
 --------------------------------------------
 

diff --git a/emacs-wrapper.sh b/emacs-wrapper.sh
new file mode 100644
index 0000000..22c8cd9
--- /dev/null
+++ b/emacs-wrapper.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+# Start Emacs with a login shell wrapper to read the user's profile
+exec -l "${SHELL}" -c "exec \"${EMACS}\" $*"

diff --git a/emacs.initd b/emacs.initd
index 38ac455..2a7c145 100644
--- a/emacs.initd
+++ b/emacs.initd
@@ -3,13 +3,16 @@
 # Distributed under the terms of the GNU General Public License v2 or later
 
 : "${EMACS:=/usr/bin/emacs}"
+: "${EMACS_START:=/usr/libexec/emacs/emacs-wrapper.sh}"
+: "${EMACS_SIGNAL_TIMEOUT:=TERM/30/KILL/5}"
 
 description="Start an Emacs server running in the background"
 
 supervisor=supervise-daemon
-command="${EMACS}"
+command="${EMACS_START}"
 command_args="${EMACS_OPTS}"
 command_args_foreground="--fg-daemon"
+retry="${EMACS_SIGNAL_TIMEOUT}"
 
 depend() {
     after dbus
@@ -26,4 +29,6 @@ start_pre() {
         eerror "${EMACS} does not support running as a daemon"
         return 1
     fi
+
+    export EMACS
 }


             reply	other threads:[~2025-03-09 20:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-09 20:47 Ulrich Müller [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-17 21:19 [gentoo-commits] proj/emacs-tools:emacs-common commit in: / Ulrich Müller
2025-03-17  9:52 Ulrich Müller
2025-03-17  9:52 Ulrich Müller
2025-03-10 12:03 Ulrich Müller
2025-03-09 20:47 Ulrich Müller
2025-03-08 16:36 Ulrich Müller
2025-03-08 16:32 Ulrich Müller
2025-03-08  8:44 Ulrich Müller
2025-03-08  8:39 Ulrich Müller
2025-03-08  8:18 Ulrich Müller
2025-03-08  6:20 Ulrich Müller
2025-03-07 18:35 Ulrich Müller
2025-03-07  6:20 Ulrich Müller
2024-05-05 12:43 Ulrich Müller
2023-09-13  7:29 Ulrich Müller
2023-09-12 16:21 Ulrich Müller
2023-07-24 16:07 Ulrich Müller
2023-07-24 16:07 Ulrich Müller
2021-03-22  8:34 Ulrich Müller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1741549478.88623eaf009738afd30693093a3b1d9abf00a858.ulm@gentoo \
    --to=ulm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox