diff options
| author | Karoly Lorentey | 2006-02-23 02:59:27 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2006-02-23 02:59:27 +0000 |
| commit | 5f3c1a63f31f77f60b8a60518ce3eda6a51f72b9 (patch) | |
| tree | 3aaa3fd52891fe8e43fe69f10c00595e341f3a75 | |
| parent | 36b98f827848d2b1ece6aee7a372902e78120e98 (diff) | |
| download | emacs-5f3c1a63f31f77f60b8a60518ce3eda6a51f72b9.tar.gz emacs-5f3c1a63f31f77f60b8a60518ce3eda6a51f72b9.zip | |
Fix `server-delete-client' behavior when the user quits `kill-buffer'. (Reported by Han Boetes.)
* lisp/server.el (server-buffer-clients): Doc update.
(server-delete-client): Handle quits in kill-buffer. Don't kill modified
buffers. Add extra logging.
(server-visit-files): Don't set `server-existing-buffer' if the buffer
already has other clients.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-517
| -rw-r--r-- | README.multi-tty | 6 | ||||
| -rw-r--r-- | lisp/server.el | 30 |
2 files changed, 27 insertions, 9 deletions
diff --git a/README.multi-tty b/README.multi-tty index 49a3f7b92bf..da3ab4ade5b 100644 --- a/README.multi-tty +++ b/README.multi-tty | |||
| @@ -479,10 +479,16 @@ THINGS TO DO | |||
| 479 | multidisplay (and don't mind core dumps), you can edit src/config.h | 479 | multidisplay (and don't mind core dumps), you can edit src/config.h |
| 480 | and define HAVE_GTK_MULTIDISPLAY there by hand. | 480 | and define HAVE_GTK_MULTIDISPLAY there by hand. |
| 481 | 481 | ||
| 482 | http://bugzilla.gnome.org/show_bug.cgi?id=85715 | ||
| 483 | |||
| 482 | Update: Han reports that GTK+ version 2.8.9 almost gets display | 484 | Update: Han reports that GTK+ version 2.8.9 almost gets display |
| 483 | disconnects right. GTK will probably be fully fixed by the time | 485 | disconnects right. GTK will probably be fully fixed by the time |
| 484 | multi-tty gets into the trunk. | 486 | multi-tty gets into the trunk. |
| 485 | 487 | ||
| 488 | Update: I am still having problems with GTK+ 2.8.10. I have the | ||
| 489 | impression that the various multidisplay fixes will only get | ||
| 490 | released in GTK+ 2.10. | ||
| 491 | |||
| 486 | ** Audit `face-valid-attribute-values' usage in customize and | 492 | ** Audit `face-valid-attribute-values' usage in customize and |
| 487 | elsewhere. Its return value depends on the current window system. | 493 | elsewhere. Its return value depends on the current window system. |
| 488 | Replace static initializers using it with runtime functions. For | 494 | Replace static initializers using it with runtime functions. For |
diff --git a/lisp/server.el b/lisp/server.el index 12a56599185..86dd9a8e469 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -107,7 +107,7 @@ Each element is (PROC PROPERTIES...) where PROC is a process object, | |||
| 107 | and PROPERTIES is an association list of client properties.") | 107 | and PROPERTIES is an association list of client properties.") |
| 108 | 108 | ||
| 109 | (defvar server-buffer-clients nil | 109 | (defvar server-buffer-clients nil |
| 110 | "List of client ids for clients requesting editing of current buffer.") | 110 | "List of client processes requesting editing of current buffer.") |
| 111 | (make-variable-buffer-local 'server-buffer-clients) | 111 | (make-variable-buffer-local 'server-buffer-clients) |
| 112 | ;; Changing major modes should not erase this local. | 112 | ;; Changing major modes should not erase this local. |
| 113 | (put 'server-buffer-clients 'permanent-local t) | 113 | (put 'server-buffer-clients 'permanent-local t) |
| @@ -249,26 +249,35 @@ ENV should be in the same format as `process-environment'." | |||
| 249 | (defun server-delete-client (client &optional noframe) | 249 | (defun server-delete-client (client &optional noframe) |
| 250 | "Delete CLIENT, including its buffers, terminals and frames. | 250 | "Delete CLIENT, including its buffers, terminals and frames. |
| 251 | If NOFRAME is non-nil, let the frames live. (To be used from | 251 | If NOFRAME is non-nil, let the frames live. (To be used from |
| 252 | `delete-frame-functions'." | 252 | `delete-frame-functions'.)" |
| 253 | (server-log (concat "server-delete-client" (if noframe " noframe")) | ||
| 254 | client) | ||
| 253 | ;; Force a new lookup of client (prevents infinite recursion). | 255 | ;; Force a new lookup of client (prevents infinite recursion). |
| 254 | (setq client (server-client | 256 | (setq client (server-client |
| 255 | (if (listp client) (car client) client))) | 257 | (if (listp client) (car client) client))) |
| 256 | (let ((proc (car client)) | 258 | (let ((proc (car client)) |
| 257 | (buffers (server-client-get client 'buffers))) | 259 | (buffers (server-client-get client 'buffers))) |
| 258 | (when client | 260 | (when client |
| 259 | (setq server-clients (delq client server-clients)) | ||
| 260 | 261 | ||
| 262 | ;; Kill the client's buffers. | ||
| 261 | (dolist (buf buffers) | 263 | (dolist (buf buffers) |
| 262 | (when (buffer-live-p buf) | 264 | (when (buffer-live-p buf) |
| 263 | (with-current-buffer buf | 265 | (with-current-buffer buf |
| 264 | ;; Remove PROC from the clients of each buffer. | ||
| 265 | (setq server-buffer-clients (delq proc server-buffer-clients)) | ||
| 266 | ;; Kill the buffer if necessary. | 266 | ;; Kill the buffer if necessary. |
| 267 | (when (and (null server-buffer-clients) | 267 | (when (and (equal server-buffer-clients |
| 268 | (list proc)) | ||
| 268 | (or (and server-kill-new-buffers | 269 | (or (and server-kill-new-buffers |
| 269 | (not server-existing-buffer)) | 270 | (not server-existing-buffer)) |
| 270 | (server-temp-file-p))) | 271 | (server-temp-file-p)) |
| 271 | (kill-buffer (current-buffer)))))) | 272 | (not (buffer-modified-p))) |
| 273 | (let (flag) | ||
| 274 | (unwind-protect | ||
| 275 | (progn (setq server-buffer-clients nil) | ||
| 276 | (kill-buffer (current-buffer)) | ||
| 277 | (setq flag t)) | ||
| 278 | (unless flag | ||
| 279 | ;; Restore clients if user pressed C-g in `kill-buffer'. | ||
| 280 | (setq server-buffer-clients (list proc))))))))) | ||
| 272 | 281 | ||
| 273 | ;; Delete the client's frames. | 282 | ;; Delete the client's frames. |
| 274 | (unless noframe | 283 | (unless noframe |
| @@ -280,6 +289,8 @@ If NOFRAME is non-nil, let the frames live. (To be used from | |||
| 280 | (set-frame-parameter frame 'client nil) | 289 | (set-frame-parameter frame 'client nil) |
| 281 | (delete-frame frame)))) | 290 | (delete-frame frame)))) |
| 282 | 291 | ||
| 292 | (setq server-clients (delq client server-clients)) | ||
| 293 | |||
| 283 | ;; Delete the client's tty. | 294 | ;; Delete the client's tty. |
| 284 | (let ((terminal (server-client-get client 'terminal))) | 295 | (let ((terminal (server-client-get client 'terminal))) |
| 285 | (when (eq (terminal-live-p terminal) t) | 296 | (when (eq (terminal-live-p terminal) t) |
| @@ -844,7 +855,8 @@ so don't mark these buffers specially, just visit them normally." | |||
| 844 | (concat "File no longer exists: " filen | 855 | (concat "File no longer exists: " filen |
| 845 | ", write buffer to file? ")) | 856 | ", write buffer to file? ")) |
| 846 | (write-file filen)))) | 857 | (write-file filen)))) |
| 847 | (setq server-existing-buffer t) | 858 | (unless server-buffer-clients |
| 859 | (setq server-existing-buffer t)) | ||
| 848 | (server-goto-line-column file)) | 860 | (server-goto-line-column file)) |
| 849 | (set-buffer (find-file-noselect filen)) | 861 | (set-buffer (find-file-noselect filen)) |
| 850 | (server-goto-line-column file) | 862 | (server-goto-line-column file) |