diff --git a/emacs/doom/config.org b/emacs/doom/config.org index e18b09f..7a6b61d 100644 --- a/emacs/doom/config.org +++ b/emacs/doom/config.org @@ -60,9 +60,20 @@ (interactive) (company-abort) (evil-force-normal-state) - (+format/buffer) + (without-minibuffer '+format/buffer) ; Skip if no formatter is defined (e.g. in text mode) (save-buffer)) +(defmacro without-minibuffer (&rest body) + "Like `progn', but stop and return nil if any of BODY forms tries to use the minibuffer. + +Also disable dialogs while evaluating BODY forms, since dialogs +are just an alternative to the minibuffer." + `(catch 'tried-to-use-minibuffer + (minibuffer-with-setup-hook + (lambda (&rest args) (throw 'tried-to-use-minibuffer nil)) + (let ((use-dialog-box)) ; No cheating by using dialogs instead of minibuffer + ,@body)))) + ;; Do not ask before exiting emacs (setq confirm-kill-emacs nil) #+end_src