diff options
| -rw-r--r-- | etc/NEWS | 8 | ||||
| -rw-r--r-- | etc/emacs.service | 2 | ||||
| -rw-r--r-- | src/emacs.c | 11 |
3 files changed, 20 insertions, 1 deletions
| @@ -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. | ||
| 86 | Units that are ordered after 'emacs.service' will only be started | ||
| 87 | after Emacs has finished initialization and is ready for use. | ||
| 88 | (If your Emacs is installed in a non-standard location and you copied the | ||
| 89 | emacs.service file to eg ~/.config/systemd/user/, you will need to copy | ||
| 90 | the 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 | |||
| 7 | Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ | 7 | Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ |
| 8 | 8 | ||
| 9 | [Service] | 9 | [Service] |
| 10 | Type=simple | 10 | Type=notify |
| 11 | ExecStart=emacs --fg-daemon | 11 | ExecStart=emacs --fg-daemon |
| 12 | ExecStop=emacsclient --eval "(kill-emacs)" | 12 | ExecStop=emacsclient --eval "(kill-emacs)" |
| 13 | Environment=SSH_AUTH_SOCK=%t/keyring/ssh | 13 | Environment=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; |