From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Greg Detre Newsgroups: gmane.emacs.help Subject: Re: Emacsclient, multiple displays and hanging Date: Wed, 03 Oct 2007 17:45:19 -0000 Organization: http://groups.google.com Message-ID: <1191433519.648378.222710@57g2000hsv.googlegroups.com> References: <1191125384.791451.257590@57g2000hsv.googlegroups.com> <470158ff$0$90263$14726298@news.sunsite.dk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: sea.gmane.org 1191436971 6267 80.91.229.12 (3 Oct 2007 18:42:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 3 Oct 2007 18:42:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 03 20:42:47 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Id9BA-0001wv-7n for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Oct 2007 20:42:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Id9B5-0005ms-Sl for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Oct 2007 14:42:35 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!57g2000hsv.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 70 Original-NNTP-Posting-Host: 128.112.145.242 Original-X-Trace: posting.google.com 1191433519 9816 127.0.0.1 (3 Oct 2007 17:45:19 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 3 Oct 2007 17:45:19 +0000 (UTC) In-Reply-To: <470158ff$0$90263$14726298@news.sunsite.dk> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: 57g2000hsv.googlegroups.com; posting-host=128.112.145.242; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Original-Xref: shelby.stanford.edu gnu.emacs.help:152579 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:48087 Archived-At: Colin, Thank you very much indeed. I'll try that. g On Oct 1, 4:30 pm, "Colin S. Miller" wrote: > 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.