Added prompt option as default, to prevent quiting and losing all changes.

This commit is contained in:
ralesi 2015-01-29 09:19:55 -07:00 committed by syl20bnr
parent bfe5f520ae
commit af2b9913ba
3 changed files with 19 additions and 6 deletions

View file

@ -2003,8 +2003,10 @@ server is to use the following bindings:
Key Binding | Description
-------------------|------------------------------------------------------------
<kbd>SPC q q</kbd> | Quit Emacs and kill the server
<kbd>SPC q q</kbd> | Quit Emacs and kill the server, prompt for changed buffers to save
<kbd>SPC q Q</kbd> | Quit Emacs and kill the server, lose all unsaved changes.
<kbd>SPC q s</kbd> | Save the buffers, quit Emacs and kill the server
<kbd>SPC q z</kbd> | Kill the current frame
## Troubleshoot

View file

@ -603,19 +603,28 @@ kill internal buffers too."
(spacemacs/frame-killer)))
(defun spacemacs/save-buffers-kill-emacs ()
"Save all changed buffers and exit Spacemacs"
(interactive)
(setq spacemacs-really-kill-emacs t)
(save-buffers-kill-emacs))
(defun spacemacs/kill-emacs ()
"Lose all changes and exit Spacemacs"
(interactive)
(setq spacemacs-really-kill-emacs t)
(kill-emacs))
(defun spacemacs/frame-killer ()
"Exit server buffers and hide the main Emacs window"
(defun spacemacs/prompt-kill-emacs ()
"Prompt to save changed buffers and exit Spacemacs"
(interactive)
(server-edit)
(setq spacemacs-really-kill-emacs t)
(save-some-buffers)
(kill-emacs))
(defun spacemacs/frame-killer ()
"Kill server buffer and hide the main Emacs window"
(interactive)
(server-kill-buffer)
(make-frame-invisible nil 1))
;; A small minor mode to use a big fringe

View file

@ -202,8 +202,10 @@
:evil-leader "t SPC")
;; quit -----------------------------------------------------------------------
(evil-leader/set-key
"q s" 'spacemacs/save-buffers-kill-emacs
"q q" 'spacemacs/kill-emacs)
"qs" 'spacemacs/save-buffers-kill-emacs
"qq" 'spacemacs/prompt-kill-emacs
"qQ" 'spacemacs/kill-emacs
"qz" 'spacemacs/frame-killer)
;; window ---------------------------------------------------------------------
(defun split-window-below-and-focus ()
"Split the window vertically and focus the new window."