From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2E9861582EF for ; Sun, 09 Mar 2025 20:47:59 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 194283430E1 for ; Sun, 09 Mar 2025 20:47:59 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 1E76F110370; Sun, 09 Mar 2025 20:47:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 15F56110370 for ; Sun, 09 Mar 2025 20:47:58 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C03EE3430D0 for ; Sun, 09 Mar 2025 20:47:57 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5A0B7122C for ; Sun, 09 Mar 2025 20:47:56 +0000 (UTC) From: "Ulrich Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" Message-ID: <1741549478.88623eaf009738afd30693093a3b1d9abf00a858.ulm@gentoo> Subject: [gentoo-commits] proj/emacs-tools:emacs-common commit in: / X-VCS-Repository: proj/emacs-tools X-VCS-Files: 10emacs-common-gentoo.el ChangeLog Makefile README.daemon emacs-wrapper.sh emacs.initd X-VCS-Directories: / X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: 88623eaf009738afd30693093a3b1d9abf00a858 X-VCS-Branch: emacs-common Date: Sun, 09 Mar 2025 20:47:56 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: f8a08859-ab15-47b1-a1cf-c5c7f2060e1c X-Archives-Hash: b7ec042afb5325953126dfb7b370fcc4 commit: 88623eaf009738afd30693093a3b1d9abf00a858 Author: Ulrich Müller gentoo org> AuthorDate: Sun Mar 9 19:44:38 2025 +0000 Commit: Ulrich Müller gentoo 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 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 + + * 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 * 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 }