changeset 83192:e2567214221d

Change binding of C-x C-c to only exit emacsclient, not Emacs itself. * lisp/server.el (server-save-buffers-kill-display): New function. * lisp/files.el (ctl-x-map): Change binding of C-x C-c to server-save-buffers-kill-display. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-232
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 16 Aug 2004 19:54:16 +0000
parents bc4b91420ff4
children e6f198d9e7d3
files lisp/files.el lisp/server.el
diffstat 2 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Fri Aug 13 14:48:29 2004 +0000
+++ b/lisp/files.el	Mon Aug 16 19:54:16 2004 +0000
@@ -4570,7 +4570,7 @@
 (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" 'server-save-buffers-kill-display)
 (define-key ctl-x-map "\C-q" 'toggle-read-only)
 
 (define-key ctl-x-4-map "f" 'find-file-other-window)
--- a/lisp/server.el	Fri Aug 13 14:48:29 2004 +0000
+++ b/lisp/server.el	Mon Aug 16 19:54:16 2004 +0000
@@ -883,7 +883,20 @@
 	      ;; a minibuffer/dedicated-window (if there's no other).
 	      (error (pop-to-buffer next-buffer)))))))))
 
-(global-set-key "\C-x#" 'server-edit)
+(defun server-save-buffers-kill-display (&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."
+  (interactive "P")
+  (let ((proc (frame-parameter (selected-frame) 'client)))
+    (if (and proc)
+	(progn
+	  (save-some-buffers arg t)
+	  (server-delete-client proc))
+      (save-buffers-kill-emacs))))
+
+(global-set-key "\C-#" 'server-edit)
 
 ;;;###autoload
 (defun server-getenv (variable &optional frame)