Emacs by default does not ask if you are sure you want to exit Emacs, so I added this to my configuration to prompt me to answer yes or no before quitting Emacs.

  (setq confirm-kill-emacs 'y-or-n-p)        ;; Confirm before killing emacs

I use evil-mode so if I try to exit with :wq or :w it does prompt me in the mini buffer, but (as I am a WM only user using DWM) if I press Super+Shift+c shortcut for my WM to close a program, it prompts me with a dialog instead of the minibuffer.

enter image description here

How do I set it so no matter what, always prefer the minibuffer, not just for prompting this, but for any kind of prompt, I would prefer the minibuffer. For example I have mu4e also setup for my Email, and every time I try to resync the mails, it asks for my GPG authentication passphrase, in a GUI dialog. I would also like that to be in the minibuffer, so I want this setting to be globally set.

  • 2
    FWIW the default behaviour is intended to react with GUI dialogs when you use the mouse to invoke a command, and the minibuffer when you use the keyboard. Presumably Emacs can't tell the difference between "GUI window killed by mouse" and "GUI window killed by GUI window manager".
    – phils
    Jun 22, 2021 at 1:53
  • Yea, I figured that. Thanks for confirming I guess.
    – apoorv569
    Jun 22, 2021 at 6:21

1 Answer 1


This is controlled through the use-dialog-box variable. Either put this in your init file:

(setq use-dialog-box nil)

or use the Customize interface.

  • Though it's not involved specifically for this question, you might want to also mention option use-file-dialog.
    – Drew
    Jun 19, 2021 at 13:40
  • @Gilles thanks use-dialog-box fixed the issue.
    – apoorv569
    Jun 19, 2021 at 17:16
  • @Drew What is the use-file-dialog for? I mean when does it appears, I never until now saw it.
    – apoorv569
    Jun 19, 2021 at 17:17
  • 1
    @apoorv569 It causes the OS's file-open dialog to be used instead of prompting for a file name in the minibuffer. But that only happens when file opening is triggered by a GUI actions such as a toolbar button or the menu (see the manual for details). And only if use-dialog-box is on anyway. Jun 19, 2021 at 20:20
  • I see, I don't use toolbar, I have set the tool-bar-mode -1. I pretty much made Emacs look like Doom Emacs, as I was using it, before switching to vanilla Emacs. So I'm slowly learning how vanilla Emacs works.
    – apoorv569
    Jun 20, 2021 at 2:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.