* Emacsclient, multiple displays and hanging
@ 2007-09-30 4:09 Greg Detre
2007-09-30 15:54 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Greg Detre @ 2007-09-30 4:09 UTC (permalink / raw)
To: help-gnu-emacs
Dear all,
I try to keep the same Emacs session on my laptop running for days and
weeks at a time. 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.
This works phenomenally for me.
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 :(
I've spent a fair while scouring emacsclient tips and documentation,
but nobody appears to have mentioned this issue. Does anybody have any
ideas for how to fix or work around this?
Yours,
Greg
P.S. I wrote a tiny wrapper for Emacsclient to try and make it
friendlier for the use case I outlined above. Feel free to grab it
from here:
http://gregdetre.blogspot.com/2007/05/my-take-on-emacsclient.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacsclient, multiple displays and hanging
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
[not found] ` <mailman.1502.1191167704.18990.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2007-09-30 15:54 UTC (permalink / raw)
To: help-gnu-emacs
> From: Greg Detre <gdetre@gmail.com>
> Date: Sun, 30 Sep 2007 04:09:44 -0000
>
> I forget about twice a week, and have to kill -9 my laptop emacs :(
As a quick workaround, does it work to "kill -15"? If it does, then I
think you will see that Emacs at least saves the session in a way that
it can be later restored, and your edits are not lost.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacsclient, multiple displays and hanging
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
2007-10-03 17:45 ` Greg Detre
2007-10-10 16:04 ` Stefan Monnier
[not found] ` <mailman.1502.1191167704.18990.help-gnu-emacs@gnu.org>
2 siblings, 2 replies; 9+ messages in thread
From: Colin S. Miller @ 2007-10-01 20:30 UTC (permalink / raw)
To: help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacsclient, multiple displays and hanging
2007-10-01 20:30 ` Colin S. Miller
@ 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-10 16:04 ` Stefan Monnier
1 sibling, 2 replies; 9+ messages in thread
From: Greg Detre @ 2007-10-03 17:45 UTC (permalink / raw)
To: help-gnu-emacs
Colin,
Thank you very much indeed. I'll try that.
g
On Oct 1, 4:30 pm, "Colin S. Miller" <no-spam-
thank-...@csmiller.demon.co.uk> 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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacsclient, multiple displays and hanging
[not found] ` <mailman.1502.1191167704.18990.help-gnu-emacs@gnu.org>
@ 2007-10-03 17:47 ` Greg Detre
0 siblings, 0 replies; 9+ messages in thread
From: Greg Detre @ 2007-10-03 17:47 UTC (permalink / raw)
To: help-gnu-emacs
On Sep 30, 11:54 am, Eli Zaretskii <e...@gnu.org> wrote:
> > From: Greg Detre <gde...@gmail.com>
> > Date: Sun, 30 Sep 2007 04:09:44 -0000
>
> > I forget about twice a week, and have to kill -9 my laptop emacs :(
>
> As a quick workaround, does it work to "kill -15"? If it does, then I
> think you will see that Emacs at least saves the session in a way that
> it can be later restored, and your edits are not lost.
Thanks, Eli. That's not a bad idea, but I've found that I need to use
kill -9 usually.
g
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacsclient, multiple displays and hanging
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>
1 sibling, 0 replies; 9+ messages in thread
From: Andrew Walrond @ 2007-10-03 19:45 UTC (permalink / raw)
To: help-gnu-emacs
>> 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 :(
I haven't tried the emacsclient stuff yet, but I always run gnu screen,
then emacs within that. If you lose the connection, you'll just get
'detached' by gnu screen; no hung processes at all. And you can always
reattach with 'screen -r'
I wouldn't be without gnu screen now. And my .screenrc file is almost as
important to me as .emacs ;)
Andrew Walrond
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacsclient, multiple displays and hanging
[not found] ` <mailman.1683.1191440517.18990.help-gnu-emacs@gnu.org>
@ 2007-10-03 19:56 ` poppyer
2007-10-04 9:20 ` Andrew Walrond
0 siblings, 1 reply; 9+ messages in thread
From: poppyer @ 2007-10-03 19:56 UTC (permalink / raw)
To: help-gnu-emacs
Andrew Walrond <andrew@walrond.org> writes:
> I haven't tried the emacsclient stuff yet, but I always run gnu screen,
> then emacs within that. If you lose the connection, you'll just get
> 'detached' by gnu screen; no hung processes at all. And you can always
> reattach with 'screen -r'
>
> I wouldn't be without gnu screen now. And my .screenrc file is almost as
> important to me as .emacs ;)
>
Same with me :)
any good tips about your .screenrc file?
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacsclient, multiple displays and hanging
2007-10-03 19:56 ` poppyer
@ 2007-10-04 9:20 ` Andrew Walrond
0 siblings, 0 replies; 9+ messages in thread
From: Andrew Walrond @ 2007-10-04 9:20 UTC (permalink / raw)
To: help-gnu-emacs
poppyer wrote:
> any good tips about your .screenrc file?
>
Gnu Screen's equivalent of emacs inhibit-startup-message:
startup_message off
Since I use emacs 24/7 and need C-a, change screens escape to C-z (and
C-z to C-z z)
escape ^zz
I copied this hardstatus config from the example .screenrc I think
hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d
%C%a "
This allows emacs, less etc to reinstate the screen when they exit:
altscreen
And a lot of stuff doesn't like TERM=screen, so I change it
term xterm
Anyone else got useful .screenrc tips?
Andrew Walrond
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacsclient, multiple displays and hanging
2007-10-01 20:30 ` Colin S. Miller
2007-10-03 17:45 ` Greg Detre
@ 2007-10-10 16:04 ` Stefan Monnier
1 sibling, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2007-10-10 16:04 UTC (permalink / raw)
To: help-gnu-emacs
> 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"
In the trunk version of Emacs-CVS, there's `close-display-connection'.
But admittedly, Emacs should handle this case more transparently.
Try M-x report-emacs-bug to post this feature request.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-10-10 16:04 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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.