Mercurial > emacs
comparison lisp/files.el @ 6050:afc731c614d3
(kill-emacs-query-functions): New variable.
(save-buffers-kill-emacs): Use it.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 24 Feb 1994 04:00:41 +0000 |
parents | bee9069f17e3 |
children | b44d5d121bc5 |
comparison
equal
deleted
inserted
replaced
6049:32df2b4d67cf | 6050:afc731c614d3 |
---|---|
1998 (call-process insert-directory-program nil t nil switches | 1998 (call-process insert-directory-program nil t nil switches |
1999 (if full-directory-p | 1999 (if full-directory-p |
2000 (concat (file-name-as-directory file) ".") | 2000 (concat (file-name-as-directory file) ".") |
2001 file))))))) | 2001 file))))))) |
2002 | 2002 |
2003 (defvar kill-emacs-query-functions nil | |
2004 "Functions to call with no arguments to query about killing Emacs.") | |
2005 | |
2003 (defun save-buffers-kill-emacs (&optional arg) | 2006 (defun save-buffers-kill-emacs (&optional arg) |
2004 "Offer to save each buffer, then kill this Emacs process. | 2007 "Offer to save each buffer, then kill this Emacs process. |
2005 With prefix arg, silently save all file-visiting buffers, then kill." | 2008 With prefix arg, silently save all file-visiting buffers, then kill." |
2006 (interactive "P") | 2009 (interactive "P") |
2007 (save-some-buffers arg t) | 2010 (save-some-buffers arg t) |
2021 val) | 2024 val) |
2022 (setq active t)) | 2025 (setq active t)) |
2023 (setq processes (cdr processes))) | 2026 (setq processes (cdr processes))) |
2024 (or (not active) | 2027 (or (not active) |
2025 (yes-or-no-p "Active processes exist; kill them and exit anyway? ")))) | 2028 (yes-or-no-p "Active processes exist; kill them and exit anyway? ")))) |
2029 ;; Query the user for other things, perhaps. | |
2030 (let ((functions kill-emacs-query-functions) | |
2031 (yes t)) | |
2032 (while (and functions yes) | |
2033 (setq yes (and yes (funcall (car functions)))) | |
2034 (setq functions (cdr functions))) | |
2035 yes) | |
2026 (kill-emacs))) | 2036 (kill-emacs))) |
2027 | 2037 |
2028 (define-key ctl-x-map "\C-f" 'find-file) | 2038 (define-key ctl-x-map "\C-f" 'find-file) |
2029 (define-key ctl-x-map "\C-q" 'toggle-read-only) | 2039 (define-key ctl-x-map "\C-q" 'toggle-read-only) |
2030 (define-key ctl-x-map "\C-r" 'find-file-read-only) | 2040 (define-key ctl-x-map "\C-r" 'find-file-read-only) |