diff options
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/lisp/files.el b/lisp/files.el index a78d798f38b..fbfe0e2c996 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2362,6 +2362,7 @@ asking you for confirmation." minor-mode-overriding-map-alist mode-line-buffer-identification mode-line-format + mode-line-client mode-line-modes mode-line-modified mode-line-mule-info @@ -4094,15 +4095,6 @@ non-nil, it is called instead of rereading visited file contents." (if auto-save-p 'auto-save-coding (or coding-system-for-read buffer-file-coding-system-explicit)))) - (if (and (not enable-multibyte-characters) - (not (memq (coding-system-base - coding-system-for-read) - '(no-conversion raw-text)))) - ;; As a coding system suitable for multibyte - ;; buffer is specified, make the current - ;; buffer multibyte. - (set-buffer-multibyte t)) - ;; This force after-insert-file-set-coding ;; (called from insert-file-contents) to set ;; buffer-file-coding-system to a proper value. @@ -5116,6 +5108,22 @@ With prefix arg, silently save all file-visiting buffers, then kill." (or (null confirm-kill-emacs) (funcall confirm-kill-emacs "Really exit Emacs? ")) (kill-emacs))) + +(defun save-buffers-kill-terminal (&optional arg) + "Offer to save each buffer, then kill the current connection. +If the current frame has no client, kill Emacs itself. + +With prefix arg, silently save all file-visiting buffers, then kill. + +If emacsclient was started with a list of filenames to edit, then +only these files will be asked to be saved." + (interactive "P") + (let ((proc (frame-parameter (selected-frame) 'client)) + (frame (selected-frame))) + (if (null proc) + (save-buffers-kill-emacs) + (server-save-buffers-kill-terminal proc arg)))) + ;; We use /: as a prefix to "quote" a file name ;; so that magic file name handlers will not apply to it. @@ -5213,7 +5221,7 @@ With prefix arg, silently save all file-visiting buffers, then kill." (define-key ctl-x-map "i" 'insert-file) (define-key esc-map "~" 'not-modified) (define-key ctl-x-map "\C-d" 'list-directory) -(define-key ctl-x-map "\C-c" 'save-buffers-kill-emacs) +(define-key ctl-x-map "\C-c" 'save-buffers-kill-terminal) (define-key ctl-x-map "\C-q" 'toggle-read-only) (define-key ctl-x-4-map "f" 'find-file-other-window) |