I would like a way to make emacs to return a non-zero exit code when exiting.
This page https://www.gnu.org/software/emacs/manual/html_node/elisp/Killing-Emacs.html lists the command
kill-emacs &optional exit-data
as a mechanism for making emacs return with non-zero return code, stating "If exit-data is an integer, that is used as the exit status of the Emacs process".
How do I add this optional exit-data?
I have tried:
- Interactively using M-x kill-emacs but cannot type a space after that.
- Setting up a binding in my init.el using
(global-set-key (kbd "C-x C-M-c") 'kill-emacs)
, but do not know the syntax well enough to pass an argument.
I see this is related to How to set the exit status for emacsclient and How to make emacs or emacsclient exit with nonzero return code? , but I cannot get the answer I want from those questions/answers.
Please can someone explain how to quit emacs with a non-zero return code and/or provide the syntax to setup a keyboard binding.