* Connecting to remote Emacs?
@ 2006-06-14 9:39 alistair_happencross
2006-06-14 13:41 ` Andrea Russo
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: alistair_happencross @ 2006-06-14 9:39 UTC (permalink / raw)
I have Emacs (compiled from CVS) running pretty much 24/7 on my desktop
computer at work, displaying on the local X server.
When I'm at home, I'd like to pick up from where I left off and keep
working. I can log in to my work desktop with ssh and X forwarding.
I'd like to be able to reconnect to the running Emacs process and have
it display on my X server at home. Is this possible?
Thanks in advance.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Connecting to remote Emacs?
2006-06-14 9:39 Connecting to remote Emacs? alistair_happencross
@ 2006-06-14 13:41 ` Andrea Russo
2006-06-14 14:38 ` Xiao-Yong Jin
[not found] ` <mailman.2882.1150295429.9609.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 8+ messages in thread
From: Andrea Russo @ 2006-06-14 13:41 UTC (permalink / raw)
alistair_happencross@hotmail.com writes:
> I'd like to be able to reconnect to the running Emacs process and have
> it display on my X server at home. Is this possible?
In the X11 forwarded ssh shell:
$ emacsclient -e "(make-frame-on-display \"$DISPLAY\")"
Of course you should have started the emacs server with (server-start)
in your .emacs file.
Andrea.
--
((lambda (x) (list x x)) (lambda (x) (list x x)))
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Connecting to remote Emacs?
2006-06-14 9:39 Connecting to remote Emacs? alistair_happencross
2006-06-14 13:41 ` Andrea Russo
@ 2006-06-14 14:38 ` Xiao-Yong Jin
[not found] ` <mailman.2882.1150295429.9609.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 8+ messages in thread
From: Xiao-Yong Jin @ 2006-06-14 14:38 UTC (permalink / raw)
alistair_happencross@hotmail.com writes:
> I have Emacs (compiled from CVS) running pretty much 24/7 on my desktop
> computer at work, displaying on the local X server.
>
> When I'm at home, I'd like to pick up from where I left off and keep
> working. I can log in to my work desktop with ssh and X forwarding.
> I'd like to be able to reconnect to the running Emacs process and have
> it display on my X server at home. Is this possible?
>
> Thanks in advance.
I would like to see some kind of attaching to an exist Emacs process
such that you can reuse the same buffer opened in that Emacs Process.
But so far I can only use Emacs in screen(1).
Xiao-Yong
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.2882.1150295429.9609.help-gnu-emacs@gnu.org>]
* Re: Connecting to remote Emacs?
[not found] ` <mailman.2882.1150295429.9609.help-gnu-emacs@gnu.org>
@ 2006-06-14 18:55 ` Pascal Bourguignon
2006-06-14 20:17 ` Xiao-Yong Jin
` (2 more replies)
2006-06-16 2:15 ` Xiao-Yong Jin
1 sibling, 3 replies; 8+ messages in thread
From: Pascal Bourguignon @ 2006-06-14 18:55 UTC (permalink / raw)
Andrea Russo <rastandy@salug.it> writes:
> alistair_happencross@hotmail.com writes:
>
>> I'd like to be able to reconnect to the running Emacs process and have
>> it display on my X server at home. Is this possible?
>
> In the X11 forwarded ssh shell:
>
> $ emacsclient -e "(make-frame-on-display \"$DISPLAY\")"
>
> Of course you should have started the emacs server with (server-start)
> in your .emacs file.
This -e option is new. (Did it work already in 21.3?)
Moreover, it works only on the only emacs server per user.
I've got three emacs running (one for erc, one for gnu and one for
programming, given the lack of threads in emacs...).
So I have this in my ~/.emacs:
(defvar *frame-server-job-ticket* "~/frame-emacs"
"Path to the job-ticket file.")
(setf *frame-server-job-ticket* "~/frame-emacs")
(defun frame-server (&optional token-path)
(setf token-path (or token-path *frame-server-job-ticket*))
(when (file-exists-p token-path)
(find-file token-path)
(make-frame-on-display
(delete ?\n (prog1 (buffer-string)
(kill-buffer (current-buffer))
(delete-file token-path)))
(list (cons 'name (format "n%s" (frame-parameter nil 'name)))))))
(defun frame-server-start ()
(interactive)
(run-at-time nil 5 (function frame-server) nil))
(frame-server-start)
(cond
((member "(gnus)" command-line-args)
(setf *frame-server-job-ticket* "~/frame-gnus"))
((member "(irc)" command-line-args)
(setf *frame-server-job-ticket* "~/frame-erc"))
(t
(server-start)
(setf *frame-server-job-ticket* "~/frame-emacs")))
and I can open a new frame writing the display where to make it in one
of these files: ~/frame-gnus ~/frame-erc or ~/frame-emacs
for example with:
echo $(hostname -f)$DISPLAY | ssh $REMOTE tee -a ~/frame-emacs \
-a ~/frame-gnus \
-a ~/frame-erc
or, if you want it thru ssh:
ssh -X bash -c 'echo $DISPLAY | tee -a ~/frame-emacs \
-a ~/frame-gnus \
-a ~/frame-erc '
--
__Pascal Bourguignon__ http://www.informatimago.com/
"Indentation! -- I will show you how to indent when I indent your skull!"
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Connecting to remote Emacs?
2006-06-14 18:55 ` Pascal Bourguignon
@ 2006-06-14 20:17 ` Xiao-Yong Jin
2006-06-16 19:04 ` alistair_happencross
2006-06-16 19:08 ` alistair_happencross
2 siblings, 0 replies; 8+ messages in thread
From: Xiao-Yong Jin @ 2006-06-14 20:17 UTC (permalink / raw)
Pascal Bourguignon <pjb@informatimago.com> writes:
> Andrea Russo <rastandy@salug.it> writes:
>
>> alistair_happencross@hotmail.com writes:
>>
>>> I'd like to be able to reconnect to the running Emacs process and have
>>> it display on my X server at home. Is this possible?
>>
>> In the X11 forwarded ssh shell:
>>
>> $ emacsclient -e "(make-frame-on-display \"$DISPLAY\")"
>>
>> Of course you should have started the emacs server with (server-start)
>> in your .emacs file.
>
> This -e option is new. (Did it work already in 21.3?)
> Moreover, it works only on the only emacs server per user.
>
> I've got three emacs running (one for erc, one for gnu and one for
> programming, given the lack of threads in emacs...).
>
> So I have this in my ~/.emacs:
>
>
>
> (defvar *frame-server-job-ticket* "~/frame-emacs"
> "Path to the job-ticket file.")
> (setf *frame-server-job-ticket* "~/frame-emacs")
>
> (defun frame-server (&optional token-path)
> (setf token-path (or token-path *frame-server-job-ticket*))
> (when (file-exists-p token-path)
> (find-file token-path)
> (make-frame-on-display
> (delete ?\n (prog1 (buffer-string)
> (kill-buffer (current-buffer))
> (delete-file token-path)))
> (list (cons 'name (format "n%s" (frame-parameter nil 'name)))))))
>
> (defun frame-server-start ()
> (interactive)
> (run-at-time nil 5 (function frame-server) nil))
>
> (frame-server-start)
>
> (cond
> ((member "(gnus)" command-line-args)
> (setf *frame-server-job-ticket* "~/frame-gnus"))
> ((member "(irc)" command-line-args)
> (setf *frame-server-job-ticket* "~/frame-erc"))
> (t
> (server-start)
> (setf *frame-server-job-ticket* "~/frame-emacs")))
>
>
> and I can open a new frame writing the display where to make it in one
> of these files: ~/frame-gnus ~/frame-erc or ~/frame-emacs
> for example with:
>
> echo $(hostname -f)$DISPLAY | ssh $REMOTE tee -a ~/frame-emacs \
> -a ~/frame-gnus \
> -a ~/frame-erc
>
> or, if you want it thru ssh:
>
> ssh -X bash -c 'echo $DISPLAY | tee -a ~/frame-emacs \
> -a ~/frame-gnus \
> -a ~/frame-erc '
>
> --
> __Pascal Bourguignon__ http://www.informatimago.com/
>
> "Indentation! -- I will show you how to indent when I indent your skull!"
Great idea!
Xiao-Yong
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Connecting to remote Emacs?
2006-06-14 18:55 ` Pascal Bourguignon
2006-06-14 20:17 ` Xiao-Yong Jin
@ 2006-06-16 19:04 ` alistair_happencross
2006-06-16 19:08 ` alistair_happencross
2 siblings, 0 replies; 8+ messages in thread
From: alistair_happencross @ 2006-06-16 19:04 UTC (permalink / raw)
Pascal Bourguignon wrote:
> So I have this in my ~/.emacs:
[snip]
Thanks, Pascal. It's a really cool idea and works quite well for me --
I just had to change the setf's appropriately (are you using the CL
package?)
> or, if you want it thru ssh:
>
> ssh -X bash -c 'echo $DISPLAY | tee -a ~/frame-emacs \
> -a ~/frame-gnus \
> -a ~/frame-erc '
This doesn't seem to work for me (after adding the remote host to the
command line). I think the ssh process disconnects before the
frame-server has a chance to pick up the connection.
So I do something like this from my local shell:
$ ssh -X $remotehost
$ echo $DISPLAY | tee -a ~/frame-emacs
which is OK. However, after closing the frame with `C-x 5 0', I cannot
exit the interactive ssh session cleanly with C-d -- it needs prodding
with C-c. Maybe Emacs isn't closing the X connection properly?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Connecting to remote Emacs?
2006-06-14 18:55 ` Pascal Bourguignon
2006-06-14 20:17 ` Xiao-Yong Jin
2006-06-16 19:04 ` alistair_happencross
@ 2006-06-16 19:08 ` alistair_happencross
2 siblings, 0 replies; 8+ messages in thread
From: alistair_happencross @ 2006-06-16 19:08 UTC (permalink / raw)
Pascal Bourguignon wrote:
> Andrea Russo <rastandy@salug.it> writes:
>
> > In the X11 forwarded ssh shell:
> >
> > $ emacsclient -e "(make-frame-on-display \"$DISPLAY\")"
> >
>
> This -e option is new. (Did it work already in 21.3?)
> Moreover, it works only on the only emacs server per user.
I dug around in server.el and found this:
(defvar server-name "server")
(defvar server-socket-dir
(format "/tmp/emacs%d" (user-uid)))
So, perhaps, after setting these appropriately and using the -s option
of emacsclient, it would give functionality comparable to your solution?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Connecting to remote Emacs?
[not found] ` <mailman.2882.1150295429.9609.help-gnu-emacs@gnu.org>
2006-06-14 18:55 ` Pascal Bourguignon
@ 2006-06-16 2:15 ` Xiao-Yong Jin
1 sibling, 0 replies; 8+ messages in thread
From: Xiao-Yong Jin @ 2006-06-16 2:15 UTC (permalink / raw)
Andrea Russo <rastandy@salug.it> writes:
> alistair_happencross@hotmail.com writes:
>
>> I'd like to be able to reconnect to the running Emacs process and have
>> it display on my X server at home. Is this possible?
>
> In the X11 forwarded ssh shell:
>
> $ emacsclient -e "(make-frame-on-display \"$DISPLAY\")"
>
> Of course you should have started the emacs server with (server-start)
> in your .emacs file.
>
> Andrea.
>
> --
> ((lambda (x) (list x x)) (lambda (x) (list x x)))
After I use C-x 5 0 to close this frame, it seems some background
process is still connected -- I cannot close the ssh connection by
just exiting shell. And when I close the ssh by C-c, the remote emacs
process crashes. I tried C-x #, but it didn't help.
--
Xiao-Yong
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-06-16 19:08 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-14 9:39 Connecting to remote Emacs? alistair_happencross
2006-06-14 13:41 ` Andrea Russo
2006-06-14 14:38 ` Xiao-Yong Jin
[not found] ` <mailman.2882.1150295429.9609.help-gnu-emacs@gnu.org>
2006-06-14 18:55 ` Pascal Bourguignon
2006-06-14 20:17 ` Xiao-Yong Jin
2006-06-16 19:04 ` alistair_happencross
2006-06-16 19:08 ` alistair_happencross
2006-06-16 2:15 ` Xiao-Yong Jin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).