Search code examples
emacselisp

How to quit emacs, C x, C c says "Thou shall not quit!"


New user to emacs. Loaded a config file that contains the code below. Now everytime I want to quit emacs, it says "Thou shall not quit!"

(global-set-key (kbd "C-x C-c") (bind (message "Thou shall not quit!")))
(after 'evil
  (defadvice evil-quit (around dotemacs activate)
    (message "Thou shall not quit!"))
  (defadvice evil-quit-all (around dotemacs activate)
    (message "Thou shall not quit!")))

Here is the link to the config file. enter link description here


Solution

  • So in general, you have a standard Emacs binding which has been clobbered, and you don't know how to do the thing it used to do?

    To find out the default binding, you can start up a second Emacs instance without your init file, by running emacs -Q and then check that binding with C-hkC-xC-c

    That will tell you:

    C-x C-c runs the command save-buffers-kill-terminal

    With that knowledge, you can return to your original Emacs instance and either do this to run that command manually:

    • M-x save-buffers-kill-terminal RET

    or restore the global binding:

    • M-x global-set-key RET C-xC-c save-buffers-kill-terminal RET