Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent Emacs from exiting once the exit procedure has initiated?

Is there a way to prevent Emacs from exiting once I initiate the exit process?

I occasionally fat finger C-xC-s as C-xC-c. It isn't an awful process to get back up and running but I am curious if there is a way I can stop the exit process so that I can continue uninterrupted with all my files open.

Using GNU Emacs 24.3.1. Running on Cygwin under Window 7.

like image 514
N Klosterman Avatar asked Jan 17 '14 17:01

N Klosterman


People also ask

How do I exit without saving Emacs?

To exit emacs, use C-x C-c . It will ask you whether you want to save the changes. To prevent the question, precede the combination with C-u (but it will save the changes). If you want to kill Emacs without saving any changes, you can use the kill-emacs function ( M-x kill-emacs ).

How do I save and exit from Emacs?

To close a particular buffer, hit the keys Ctrl + x, followed by k, and then enter the buffer name. To completely close and exit Emacs, hit the keys Ctrl + x, followed by Ctrl + c. It is important to note that this action saves the buffers first, before killing Emacs.

How do I disable Emacs?

Quit emacs (Note: C-x means to press the control key and while you are holding it down, press x.

Which of the following is used to exit Emacs after prompting to save all modified files?

You can customize the value of save-some-buffers-default-predicate to control which buffers Emacs will ask about. C-x C-c , the key sequence to exit Emacs, invokes save-some-buffers and therefore asks the same questions.


1 Answers

There is a built-in variable you can set to a function like so:

(setq confirm-kill-emacs 'y-or-n-p) 
like image 151
scottfrazer Avatar answered Sep 20 '22 22:09

scottfrazer