all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Colin S. Miller" <no-spam-thank-you@csmiller.demon.co.uk>
To: help-gnu-emacs@gnu.org
Subject: Re: Emacsclient, multiple displays and hanging
Date: Mon, 01 Oct 2007 21:30:54 +0100	[thread overview]
Message-ID: <470158ff$0$90263$14726298@news.sunsite.dk> (raw)
In-Reply-To: <1191125384.791451.257590@57g2000hsv.googlegroups.com>

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.

  parent reply	other threads:[~2007-10-01 20:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-30  4:09 Emacsclient, multiple displays and hanging Greg Detre
2007-09-30 15:54 ` Eli Zaretskii
2007-10-01 20:30 ` Colin S. Miller [this message]
2007-10-03 17:45   ` Greg Detre
2007-10-03 19:45     ` Andrew Walrond
     [not found]     ` <mailman.1683.1191440517.18990.help-gnu-emacs@gnu.org>
2007-10-03 19:56       ` poppyer
2007-10-04  9:20         ` Andrew Walrond
2007-10-10 16:04   ` Stefan Monnier
     [not found] ` <mailman.1502.1191167704.18990.help-gnu-emacs@gnu.org>
2007-10-03 17:47   ` Greg Detre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='470158ff$0$90263$14726298@news.sunsite.dk' \
    --to=no-spam-thank-you@csmiller.demon.co.uk \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.