aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS8
-rw-r--r--etc/emacs.service2
-rw-r--r--src/emacs.c11
3 files changed, 20 insertions, 1 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 21b648cbb4c..995ceb67b78 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -81,6 +81,14 @@ work right without some adjustment:
81- you can use the new 'package-quickstart' so activation of packages does not 81- you can use the new 'package-quickstart' so activation of packages does not
82 need to pay attention to 'package-load-list' or 'package-user-dir' any more. 82 need to pay attention to 'package-load-list' or 'package-user-dir' any more.
83 83
84---
85** Emacs now notifies systemd when startup finishes or shutdown begins.
86Units that are ordered after 'emacs.service' will only be started
87after Emacs has finished initialization and is ready for use.
88(If your Emacs is installed in a non-standard location and you copied the
89emacs.service file to eg ~/.config/systemd/user/, you will need to copy
90the new version of the file again.)
91
84 92
85* Changes in Emacs 27.1 93* Changes in Emacs 27.1
86 94
diff --git a/etc/emacs.service b/etc/emacs.service
index b29177b120c..dbcb6bc301e 100644
--- a/etc/emacs.service
+++ b/etc/emacs.service
@@ -7,7 +7,7 @@ Description=Emacs text editor
7Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ 7Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/
8 8
9[Service] 9[Service]
10Type=simple 10Type=notify
11ExecStart=emacs --fg-daemon 11ExecStart=emacs --fg-daemon
12ExecStop=emacsclient --eval "(kill-emacs)" 12ExecStop=emacsclient --eval "(kill-emacs)"
13Environment=SSH_AUTH_SOCK=%t/keyring/ssh 13Environment=SSH_AUTH_SOCK=%t/keyring/ssh
diff --git a/src/emacs.c b/src/emacs.c
index 861d70735ca..130a9f8fc8e 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -2019,6 +2019,10 @@ all of which are called before Emacs is actually killed. */
2019{ 2019{
2020 int exit_code; 2020 int exit_code;
2021 2021
2022#ifdef HAVE_LIBSYSTEMD
2023 sd_notify(0, "STOPPING=1");
2024#endif /* HAVE_LIBSYSTEMD */
2025
2022 /* Fsignal calls emacs_abort () if it sees that waiting_for_input is 2026 /* Fsignal calls emacs_abort () if it sees that waiting_for_input is
2023 set. */ 2027 set. */
2024 waiting_for_input = 0; 2028 waiting_for_input = 0;
@@ -2479,6 +2483,13 @@ from the parent process and its tty file descriptors. */)
2479 error ("This function can only be called after loading the init files"); 2483 error ("This function can only be called after loading the init files");
2480#ifndef WINDOWSNT 2484#ifndef WINDOWSNT
2481 2485
2486 if (daemon_type == 1)
2487 {
2488#ifdef HAVE_LIBSYSTEMD
2489 sd_notify(0, "READY=1");
2490#endif /* HAVE_LIBSYSTEMD */
2491 }
2492
2482 if (daemon_type == 2) 2493 if (daemon_type == 2)
2483 { 2494 {
2484 int nfd; 2495 int nfd;