diff options
| author | Stefan Monnier | 2012-04-04 13:13:00 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-04-04 13:13:00 -0400 |
| commit | e5248ac91dfc4dcd28f066af6de4896cda98e4b2 (patch) | |
| tree | ae8a749cb037cf791bc1b0379e187ee061c89afe | |
| parent | b4243e226b29e46f7c15f2b7bdd5c7cbb0d4f4e1 (diff) | |
| download | emacs-e5248ac91dfc4dcd28f066af6de4896cda98e4b2.tar.gz emacs-e5248ac91dfc4dcd28f066af6de4896cda98e4b2.zip | |
* lisp/server.el (server--on-display-p): New function.
(server--on-display-p): Use it.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/server.el | 15 |
2 files changed, 17 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 68f99882579..4d5d5b2f933 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-04-04 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * server.el (server--on-display-p): New function. | ||
| 4 | (server--on-display-p): Use it. | ||
| 5 | |||
| 1 | 2012-04-04 Gabor Vida <vidagabor@gmail.com> (tiny change) | 6 | 2012-04-04 Gabor Vida <vidagabor@gmail.com> (tiny change) |
| 2 | 7 | ||
| 3 | * ido.el (ido-wide-find-dirs-or-files): Use file-name-absolute-p | 8 | * ido.el (ido-wide-find-dirs-or-files): Use file-name-absolute-p |
diff --git a/lisp/server.el b/lisp/server.el index ed83225eccd..404bebc4747 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -367,18 +367,27 @@ If CLIENT is non-nil, add a description of it to the logged message." | |||
| 367 | (server-log (format "Status changed to %s: %s" (process-status proc) msg) proc) | 367 | (server-log (format "Status changed to %s: %s" (process-status proc) msg) proc) |
| 368 | (server-delete-client proc)) | 368 | (server-delete-client proc)) |
| 369 | 369 | ||
| 370 | (defun server--on-display-p (frame display) | ||
| 371 | (and (equal (frame-parameter frame 'display) display) | ||
| 372 | ;; Note: TTY frames still get a `display' parameter set to the value of | ||
| 373 | ;; $DISPLAY. This is useful when running from that tty frame | ||
| 374 | ;; sub-processes that want to connect to the X server, but that means we | ||
| 375 | ;; have to be careful here not to be tricked into thinking those frames | ||
| 376 | ;; are on `display'. | ||
| 377 | (not (eq (framep frame) t)))) | ||
| 378 | |||
| 370 | (defun server-select-display (display) | 379 | (defun server-select-display (display) |
| 371 | ;; If the current frame is on `display' we're all set. | 380 | ;; If the current frame is on `display' we're all set. |
| 372 | ;; Similarly if we are unable to open frames on other displays, there's | 381 | ;; Similarly if we are unable to open frames on other displays, there's |
| 373 | ;; nothing more we can do. | 382 | ;; nothing more we can do. |
| 374 | (unless (or (not (fboundp 'make-frame-on-display)) | 383 | (unless (or (not (fboundp 'make-frame-on-display)) |
| 375 | (equal (frame-parameter (selected-frame) 'display) display)) | 384 | (server--on-display-p (selected-frame) display)) |
| 376 | ;; Otherwise, look for an existing frame there and select it. | 385 | ;; Otherwise, look for an existing frame there and select it. |
| 377 | (dolist (frame (frame-list)) | 386 | (dolist (frame (frame-list)) |
| 378 | (when (equal (frame-parameter frame 'display) display) | 387 | (when (server--on-display-p frame display) |
| 379 | (select-frame frame))) | 388 | (select-frame frame))) |
| 380 | ;; If there's no frame on that display yet, create and select one. | 389 | ;; If there's no frame on that display yet, create and select one. |
| 381 | (unless (equal (frame-parameter (selected-frame) 'display) display) | 390 | (unless (server--on-display-p (selected-frame) display) |
| 382 | (let* ((buffer (generate-new-buffer " *server-dummy*")) | 391 | (let* ((buffer (generate-new-buffer " *server-dummy*")) |
| 383 | (frame (make-frame-on-display | 392 | (frame (make-frame-on-display |
| 384 | display | 393 | display |