Skip to content

Disabling Prompts in Emacs

by mickey on November 14th, 2010

I find prompts in Emacs very annoying and in-my-face, so I have gone out of my way to remove or minimize any interaction I have with them.

Let’s start out by getting rid of the “yes or no” prompt and replace it with “y or n”:

(fset 'yes-or-no-p 'y-or-n-p)

Next up is the annoying confirmation if a file or buffer does not exist when you use C-x C-f or C-x b.

(setq confirm-nonexistent-file-or-buffer nil)

If you use ido-mode I recommend disabling the prompt that asks you if you want to create a new buffer if you enter a non-existent buffer in C-x b. You can replace always with never which does the opposite: disables new buffer creation in ido’s switch buffer routine. Setting it to never is an exceptionally bad idea as creating buffers on-the-fly is a very useful thing to do if you want a quick throw-away buffer.

(setq ido-create-new-buffer 'always)

You can also rid yourself of the splash screen and the echo area message:

(setq inhibit-startup-message t
      inhibit-startup-echo-area-message t)

And finally, the recently-added prompt in Emacs 23.2 that asks you if you want to kill a buffer with a live process attached to it:

(setq kill-buffer-query-functions
  (remq 'process-kill-buffer-query-function
         kill-buffer-query-functions))
6 Comments
  1. h3rd3r permalink

    How to remove a confirmation question with ‘M-x revert-buffer’ ?

  2. Paul permalink

    Inhibiting the echo area message like that just leaves some other emacs initialization message in the echo area. To completely get rid of it or display a custom message fset the startup-echo-area-message function to one returning your own message string.

  3. sinners permalink

    kill-buffer-query-functions is a variable,value is nil ,then the last (remq ‘process-kill-buffer-query-function
    kill-buffer-query-functions) no effect

    • mickey permalink

      Then something in your .emacs file is already changing it, or you are using an older version(?) of Emacs.

      • sinners permalink

        my emacs is 24.2,after this setting,kill-buffer-query-function value is (server-kill-bufer-query-function)

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS