Skip to content

Commit

Permalink
process-kill-buffer-query-function, server-kill-buffer-query-function…
Browse files Browse the repository at this point in the history
…: reverse confirmation question

Invert the confirmation question when killing buffers with associated processes or server clients.
Answering "no" will now kill the buffer, which is coherent with "save changes?".
  • Loading branch information
davidswelt committed Nov 9, 2009
1 parent a6acc33 commit b82b894
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lisp/server.el
Expand Up @@ -1287,8 +1287,10 @@ specifically for the clients and did not exist before their request for it."
(when (and (memq proc server-clients)
(eq (process-status proc) 'open))
(setq res nil))))
(yes-or-no-p (format "Buffer `%s' still has clients; kill it? "
(buffer-name (current-buffer))))))
(not (aquamacs-ask-for-confirmation
(format "Buffer `%s' still has clients; keep the buffer? "
(buffer-name (current-buffer)))
nil "Keep" "Discard" t 'no-cancel))))

(defun server-kill-emacs-query-function ()
"Ask before exiting Emacs if it has live clients."
Expand Down
4 changes: 2 additions & 2 deletions lisp/subr.el
Expand Up @@ -1770,8 +1770,8 @@ Value is t if a query was formerly required."
(or (not process)
(not (memq (process-status process) '(run stop open listen)))
(not (process-query-on-exit-flag process))
(aquamacs-ask-for-confirmation "Buffer has a running process; kill it?
Discarding the buffer will also stop the process." nil "Kill" "Don't Kill" t 'no-cancel))))
(not (aquamacs-ask-for-confirmation "Buffer has a running process; keep the buffer?
Discarding the buffer would also stop the process." nil "Keep" "Discard" t 'no-cancel)))))

(add-hook 'kill-buffer-query-functions 'process-kill-buffer-query-function)

Expand Down

0 comments on commit b82b894

Please sign in to comment.