diff options
| -rw-r--r-- | evil-commands.el | 13 | ||||
| -rw-r--r-- | evil-maps.el | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/evil-commands.el b/evil-commands.el index 51e7142..758ae1c 100644 --- a/evil-commands.el +++ b/evil-commands.el @@ -2817,6 +2817,19 @@ is closed." (set-process-query-on-exit-flag process nil)) (kill-emacs))))) +(evil-define-command evil-quit-all-with-error-code (&optional force) + "Exits Emacs without saving, returning an non-zero error code. +The FORCE argument is only there for compatibility and is ignored. +This function fails with an error if Emacs is run in server mode." + :repeat nil + (interactive "<!>") + (if (and (boundp 'server-buffer-clients) + (fboundp 'server-edit) + (fboundp 'server-buffer-done) + server-buffer-clients) + (user-error "Cannot exit client process with error code.") + (kill-emacs 1))) + (evil-define-command evil-save-and-quit () "Exits Emacs, without saving." (save-buffers-kill-terminal t)) diff --git a/evil-maps.el b/evil-maps.el index 5360164..9f462cb 100644 --- a/evil-maps.el +++ b/evil-maps.el @@ -465,6 +465,7 @@ included in `evil-insert-state-bindings' by default." (evil-ex-define-cmd "wq" 'evil-save-and-close) (evil-ex-define-cmd "quita[ll]" 'evil-quit-all) (evil-ex-define-cmd "qa[ll]" "quitall") +(evil-ex-define-cmd "cq[uit]" 'evil-quit-all-with-error-code) (evil-ex-define-cmd "wqa[ll]" 'evil-save-and-quit) (evil-ex-define-cmd "xa[ll]" "wqall") (evil-ex-define-cmd "x[it]" 'evil-save-modified-and-close) |
