0

When closing emacs, if I have unsaved buffers its a long process of having to read the questions (at first the logic is 'n' to not save and exit), then it changes to must type yes. Ideally there would be no 2nd question where one has to type out yes or no (it is redundant).

So I am trying to make it exit straight away with no questions (less ideal) with these lines in init.el:

;; Dont ask to save when quitting
(setq confirm-kill-processes nil)

But nothing of the behavior has changed. I still get asked all the same questions. If I read the help on the variable I can confirm its value has been changed to nil:

confirm-kill-processes is a variable defined in ‘files.el’.
Its value is nil
Original value was t

Documentation:
Non-nil if Emacs should confirm killing processes on exit.
If this variable is nil, the value of
‘process-query-on-exit-flag’ is ignored.  Otherwise, if there are
processes with a non-nil ‘process-query-on-exit-flag’, Emacs will
prompt the user before killing them.

You can customize this variable.

This variable was introduced, or its default value was changed, in
version 26.1 of Emacs.
1

if I have unsaved buffers its a long process of having to read the questions...

Has nothing to do with:

confirm-kill-processes is a variable defined in ‘files.el’.

Non-nil if Emacs should confirm killing processes on exit.

Saving buffers and killing processes are two entirely different things, so naturally setting confirm-kill-processes to nil (or anything else) has no bearing on whether Emacs asks you to save your un-saved work.

1
0
;;; ============================================================================
;;; QUITTING Emacs

(defun _my-quit-emacs ()
  "When exiting Emacs, offer to save unsaved buffers, but then quit without asking if still wish to quit if there are unsaved buffers."
  (save-some-buffers nil t)
  (kill-emacs))

(defun save-buffers-kill-terminal (&optional arg)
  "Override the existing quit Emacs function via C-x C-c."
  (interactive)
  (_my-quit-emacs))

(defun save-buffers-kill-emacs (&optional arg)
  "Override the existing quit Emacs function via the mouse."
  (interactive)
  (_my-quit-emacs))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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