|
From: | Colin S. Miller |
Subject: | Re: Emacsclient, multiple displays and hanging |
Date: | Mon, 01 Oct 2007 21:30:54 +0100 |
User-agent: | Icedove 1.5.0.12 (X11/20070607) |
Greg Detre wrote:
Dear all, When I'm at work, I want to be able to use that same emacs session on my desktop. So I sit at my desktop and ssh into my laptop, using emacsclient and 'make-frame-on-display' to bring up a new emacsclient session on my desktop, continuing where I left off. The problem comes when I remove my laptop. If I forgot to close all the running emacsclient windows on my desktop, then emacs on my laptop hangs (since it's waiting for some kind of X input from the emacsclient running on my desktop). Obviously the solution is to always shut all the emacsclients on my desktop before unplugging my laptop, but I forget about twice a week, and have to kill -9 my laptop emacs :(
Greg, the following function will kill all X-Frames on a named display (defun csm-kill-frames-on-device (display) "kill all frames on display DISPLAY" (let ((dvce)) (loop for frm in (frame-list) do (progn (setq dvce (frame-device frm)) (if (device-on-window-system-p dvce) (if (string-equal (device-connection dvce) display) (delete-frame frm))))))) or (defun csm-kill-all-non-local-x-frames () "kill all frames that are not on :0.0" (let ((dvce)) (loop for frm in (frame-list) do (progn (setq dvce (frame-device frm)) (if (device-on-window-system-p dvce) (if (not (string-equal (device-connection dvce) '":0.0")) (delete-frame frm))))))) If you close your laptop's lid before unplugging it, you can catch the kill -SIGPWR with an external script, have it run emacsclient, calling either the above functions to kill connections from your desktop. SIGPWR is sent when a UPS connected machine switches to UPS power, I'd assume it's also sent when a machine is hibernated/suspended (or resumed). I can't see of a way to handle signals inside emacs, so an external script is a necessary evil. HTH, Colin S. Miller -- Replace the obvious in my email address with the first three letters of the hostname to reply.
[Prev in Thread] | Current Thread | [Next in Thread] |