From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/emacs-tools:emacs-daemon commit in: /
Date: Sun, 09 Mar 2025 20:48:04 +0000 (UTC) [thread overview]
Message-ID: <1741549162.0381452423e624e26fc554f759ea84d6f47a8143.ulm@gentoo> (raw)
commit: 0381452423e624e26fc554f759ea84d6f47a8143
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 9 19:39:22 2025 +0000
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sun Mar 9 19:39:22 2025 +0000
URL: https://gitweb.gentoo.org/proj/emacs-tools.git/commit/?id=03814524
Wrapper and site-init moved to emacs-common
* emacs-wrapper.sh:
* 10emacs-daemon-gentoo.el: Files removed. These have been moved
to the emacs-common package.
* Makefile (DISTFILES): Updated.
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
10emacs-daemon-gentoo.el | 26 --------------------------
ChangeLog | 7 +++++++
Makefile | 3 +--
emacs-wrapper.sh | 3 ---
emacs.conf | 6 ++----
emacs.rc | 42 +++++++++++++++++++++---------------------
6 files changed, 31 insertions(+), 56 deletions(-)
diff --git a/10emacs-daemon-gentoo.el b/10emacs-daemon-gentoo.el
deleted file mode 100644
index b878eb4..0000000
--- a/10emacs-daemon-gentoo.el
+++ /dev/null
@@ -1,26 +0,0 @@
-;;; emacs-daemon site-lisp configuration
-
-;; Copyright 2008-2025 Gentoo Authors
-;; Distributed under the terms of the GNU General Public License v2 or later
-
-(and
- (daemonp)
- (null after-init-time)
- (let* ((file (concat "/var/run/emacs/" (user-login-name) "/emacs.pid"))
- (pid (if (file-readable-p file)
- ;; Get process id from file
- (with-temp-buffer
- (ignore-errors
- (insert-file-contents-literally file nil 0 100)
- (and (looking-at "[0-9]+")
- (string-to-number (match-string 0))))))))
- (when (and (integerp pid)
- (string-match
- "emacs" (or (cdr (assq 'comm (process-attributes pid))) ""))
- (/= pid (emacs-pid)))
- ;; If another Emacs daemon is already running for this user,
- ;; then we would steal its server socket. So we better die.
- (message "Another Emacs daemon is already running at process id %d" pid)
- (kill-emacs))
- ;; Restart the server if signal SIGUSR1 is received.
- (define-key special-event-map [sigusr1] #'server-start)))
diff --git a/ChangeLog b/ChangeLog
index bb62705..35823a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-03-09 Ulrich Müller <ulm@gentoo.org>
+
+ * emacs-wrapper.sh:
+ * 10emacs-daemon-gentoo.el: Files removed. These have been moved
+ to the emacs-common package.
+ * Makefile (DISTFILES): Updated.
+
2025-03-07 Ulrich Müller <ulm@gentoo.org>
* emacs.rc (checkconfig): Make running Emacs more robust.
diff --git a/Makefile b/Makefile
index f180383..2e866ae 100644
--- a/Makefile
+++ b/Makefile
@@ -6,8 +6,7 @@ PV = $(shell sed '/^[ \t]*\* .*[Vv]ersion/!d;s/[^0-9.]*\([0-9.]*\).*/\1/;q' \
ChangeLog)
P = $(PN)-$(PV)
-DISTFILES = README ChangeLog emacs.rc emacs.conf emacs-wrapper.sh \
- 10emacs-daemon-gentoo.el
+DISTFILES = README ChangeLog emacs.rc emacs.conf
.PHONY: all dist clean
diff --git a/emacs-wrapper.sh b/emacs-wrapper.sh
deleted file mode 100644
index 22c8cd9..0000000
--- a/emacs-wrapper.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/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.conf b/emacs.conf
index b962fd9..54a4880 100644
--- a/emacs.conf
+++ b/emacs.conf
@@ -8,10 +8,8 @@
# Options to pass to emacs. Don't remove "--fg-daemon".
#EMACS_OPTS="--fg-daemon"
-# Emacs detaches and exits the parent process only after loading the
-# user's .emacs (initialisation). Anything may happen there, so we use
-# a wrapper script to ensure that the Emacs daemon properly starts.
-# This also executes a login shell to read the user's profile. #246460
+# Wrapper script for starting Emacs. This executes a login shell,
+# in order to read the user's profile. #246460
#EMACS_START="/usr/libexec/emacs/emacs-wrapper.sh"
# Optionally, you may execute a custom script before stopping the
diff --git a/emacs.rc b/emacs.rc
index 35a76f9..8302aa8 100644
--- a/emacs.rc
+++ b/emacs.rc
@@ -2,11 +2,11 @@
# Copyright 2008-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 or later
-: ${EMACS:=/usr/bin/emacs}
-: ${EMACS_OPTS:=--fg-daemon}
-: ${EMACS_SHELL=/bin/bash}
-: ${EMACS_START:=/usr/libexec/emacs/emacs-wrapper.sh}
-: ${EMACS_TIMEOUT:=30}
+: "${EMACS:=/usr/bin/emacs}"
+: "${EMACS_OPTS:=--fg-daemon}"
+: "${EMACS_SHELL=/bin/bash}"
+: "${EMACS_START:=/usr/libexec/emacs/emacs-wrapper.sh}"
+: "${EMACS_TIMEOUT:=30}"
USER=${RC_SVCNAME##*.}
PIDFILE_DIR=/var/run/emacs/${USER}
PIDFILE=${PIDFILE_DIR}/emacs.pid
@@ -20,14 +20,14 @@ depend() {
checkconfig() {
if [ "${USER}" = "${RC_SVCNAME}" ]; then
- eerror "You have to create an init script for each user:"
- eerror "ln -s emacs /etc/init.d/emacs.<user>"
- return 1
+ eerror "You have to create an init script for each user:"
+ eerror "ln -s emacs /etc/init.d/emacs.<user>"
+ return 1
fi
if ! id -u "${USER}" >/dev/null; then
- eerror "${USER}: No such user"
- return 1
+ eerror "${USER}: No such user"
+ return 1
fi
# EMACS could be a microemacs variant that ignores the -batch option
@@ -35,10 +35,10 @@ checkconfig() {
# Redirecting stdin and unsetting TERM and DISPLAY will cause most
# of them to exit with an error.
local has_daemon=$(unset TERM DISPLAY; ${EMACS} -batch -q --no-site-file \
- --eval "(princ (fboundp 'daemonp))" </dev/null)
+ --eval "(princ (fboundp 'daemonp))" </dev/null)
if [ "${has_daemon}" != t ]; then
- eerror "${EMACS} does not support running as a daemon"
- return 1
+ eerror "${EMACS} does not support running as a daemon"
+ return 1
fi
checkpath -d --owner 0 --mode 0755 "${PIDFILE_DIR%/*}"
@@ -52,7 +52,7 @@ start() {
eval home="~${USER}"
SHELL=${EMACS_SHELL:-$(awk -F: "\$1 == \"${USER}\" { print \$7 }" \
- /etc/passwd)}
+ /etc/passwd)}
export SHELL EMACS
# XDG_RUNTIME_DIR points to /run/user/0 which is not writable for us
@@ -61,22 +61,22 @@ start() {
ebegin "Starting Emacs daemon for user ${USER}"
start-stop-daemon --start --background --make-pidfile \
- --user "${USER}" --pidfile "${PIDFILE}" --chdir "${home}" \
- --exec "${EMACS_START}" -- ${EMACS_OPTS}
+ --user "${USER}" --pidfile "${PIDFILE}" --chdir "${home}" \
+ --exec "${EMACS_START}" -- ${EMACS_OPTS}
eend $?
}
stop() {
# Optionally, call a custom script before stopping.
if [ "${EMACS_STOP}" ] && [ -x "${EMACS_STOP}" ]; then
- export USER PIDFILE EMACS EMACS_TIMEOUT
- ebegin "Calling Emacs stop script for ${USER}"
- "${EMACS_STOP}"
- eend $? || return
+ export USER PIDFILE EMACS EMACS_TIMEOUT
+ ebegin "Calling Emacs stop script for ${USER}"
+ "${EMACS_STOP}"
+ eend $? || return
fi
ebegin "Stopping Emacs daemon for user ${USER}"
start-stop-daemon --stop --retry "TERM/${EMACS_TIMEOUT}/KILL/5" \
- --user "${USER}" --pidfile "${PIDFILE}" --exec "${EMACS}"
+ --user "${USER}" --pidfile "${PIDFILE}" --exec "${EMACS}"
eend $?
}
next reply other threads:[~2025-03-09 20:48 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-09 20:48 Ulrich Müller [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-03-14 22:27 [gentoo-commits] proj/emacs-tools:emacs-daemon commit in: / Ulrich Müller
2025-03-14 22:27 Ulrich Müller
2025-03-10 12:03 Ulrich Müller
2025-03-07 16:58 Ulrich Müller
2025-03-05 15:56 Ulrich Müller
2025-03-05 13:36 Ulrich Müller
2025-03-05 13:08 Ulrich Müller
2025-03-05 13:08 Ulrich Müller
2018-12-09 22:36 Ulrich Müller
2018-09-16 14:49 Ulrich Müller
2016-06-08 6:43 Ulrich Müller
2016-05-06 13:20 Ulrich Müller
2016-05-06 13:20 Ulrich Müller
2016-05-06 13:20 Ulrich Müller
2014-02-02 11:29 Ulrich Müller
2014-02-02 11:29 Ulrich Müller
2013-08-06 19:09 Ulrich Mueller
2013-08-06 19:09 Ulrich Mueller
2013-03-23 22:08 Ulrich Mueller
2013-03-23 22:08 Ulrich Mueller
2013-03-23 22:08 Ulrich Mueller
2013-03-23 22:08 Ulrich Mueller
2012-07-21 9:01 Ulrich Mueller
2012-07-21 9:01 Ulrich Mueller
2012-05-06 18:47 Ulrich Mueller
2012-05-06 18:14 Ulrich Mueller
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=1741549162.0381452423e624e26fc554f759ea84d6f47a8143.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