I am using EXWM on Arch as my windows manager. Substantially my
exec dbus-launch --exit-with-session emacs so I am running only emacs and living inside it. I would like to define a function
shutdown to properly handle the shutdown of my computer terminating
every process in a graceful way. This function has to:
- Check in every frame if there are running processes that I've personally started
- Ask if I want to continue
SIGHUPto each of these process
- Check if those process have quit, if not send them a stronger signal
- Exit emacs
- Shutdown the computer
I want to kill processes with
SIGHUP, which is the signal
sends, because using
(save-buffer-kill-emacs) kills them too brutally.
For example Chromium always asks me if I want to restore previous session,
whereas killing Chromium with
SIGHUP makes it restore the correct session the
next time I start it.
I want to properly quit emacs before shutting down the computer because if I use
(shell-command "shutdown now") it prevents emacs to correctly run every exit-hook (for
example it doesn't remove the
My workaround for this problem is to schedule a shutdown 3 seconds in the
future, so emacs can properly quit, but it is not very elegant.
How can I do?