commit:     de80c9fcb1c2d67c6bb3f0019b08a6ed014c92e6
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Fri Mar  7 18:34:37 2025 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Fri Mar  7 18:34:37 2025 +0000
URL:        https://gitweb.gentoo.org/repo/proj/emacs.git/commit/?id=de80c9fc

app-emacs/emacs-common: Install user initd file

Bug: https://bugs.gentoo.org/950671
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 app-emacs/emacs-common/emacs-common-9999.ebuild | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/app-emacs/emacs-common/emacs-common-9999.ebuild 
b/app-emacs/emacs-common/emacs-common-9999.ebuild
index 2349bac..6db48eb 100644
--- a/app-emacs/emacs-common/emacs-common-9999.ebuild
+++ b/app-emacs/emacs-common/emacs-common-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -32,6 +32,10 @@ src_install() {
        insinto /etc/emacs
        doins site-start.el
 
+       exeinto /etc/user/init.d
+       sed -e "s,/usr/bin/emacs,${EPREFIX}&," emacs.initd | newexe - emacs
+       pipestatus || die
+
        if use games; then
                keepdir /var/games/emacs
                fowners 0:gamestat /var/games/emacs
@@ -66,10 +70,25 @@ src_install() {
                site startup file /etc/emacs/site-start.el is installed. You are
                responsible for maintenance of this file.
                \n\nAlternatively, individual users can add the following 
command:
-               \n\n(require 'site-gentoo)
+               \n\n\t(require 'site-gentoo)
                \n\nto their ~/.emacs initialisation files, or, for greater
                flexibility, users may load single package-specific 
initialisation
                files from the ${SITELISP}/site-gentoo.d/ directory."
+
+       [[ -d /run/openrc ]] && DOC_CONTENTS+="\n\n\nTo have OpenRC
+               (version 0.60 or later) automatically start Emacs as a daemon in
+               your user session, login as normal user and execute the command:
+               \n\n\t$ rc-update --user add emacs default
+               \n\nThis will add emacs to the default runlevel in
+               ~/.config/rc/runlevels/.
+               \n\nIf you want to start your user's Emacs daemon at system 
startup
+               and have it persist between login sessions, do the following in
+               addition (as the superuser):
+               \n\n\t# ln -s user /etc/init.d/user.<user>
+               \n\t# rc-service user.<user> start
+               \n\t# rc-update add user.<user> default
+               \n\nSee OpenRC's user guide for the full documentation."
+
        readme.gentoo_create_doc
 }
 

Reply via email to