Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to resume a remote repl session? and edit running code?

17 views
Skip to first unread message

jingt...@gmail.com

unread,
Jul 28, 2008, 3:59:06 PM7/28/08
to
This is probably a newbie question. And it might have more to do with
ssh setup than lisp.

I'm writing a web/app on a remote ubuntu server through putty. Usually
I develop the code in an emacs/slime repl session open on the remote
server. However sometimes the connection gets cut off (whether
intentionally or not) and I will have to re-login the putty session.
Checking the list of processes I can see that emacs is still running
(sometimes it doesn't, not sure why). Is there anyway I can resume
that emacs/repl session? (Currently, I just kill that old emacs
process and start a new one and reload everything, which can be a
pain.)

This naturally leads to the second question. If I have a remotely
running lisp code, how do you edit it without killing the original
process? Much like in erlang. (I got a feeling that Lisp can do that
from all the motivational Paul Graham essays that got me into lisp.)

Zach Beane

unread,
Jul 28, 2008, 4:08:12 PM7/28/08
to
jingt...@gmail.com writes:

> This is probably a newbie question. And it might have more to do with
> ssh setup than lisp.
>
> I'm writing a web/app on a remote ubuntu server through putty. Usually
> I develop the code in an emacs/slime repl session open on the remote
> server. However sometimes the connection gets cut off (whether
> intentionally or not) and I will have to re-login the putty session.
> Checking the list of processes I can see that emacs is still running
> (sometimes it doesn't, not sure why). Is there anyway I can resume
> that emacs/repl session? (Currently, I just kill that old emacs
> process and start a new one and reload everything, which can be a
> pain.)

I don't know if you can resume the Emacs in any way, sorry.

> This naturally leads to the second question. If I have a remotely
> running lisp code, how do you edit it without killing the original
> process? Much like in erlang. (I got a feeling that Lisp can do that
> from all the motivational Paul Graham essays that got me into lisp.)

I use "screen" to suspend and resume remote sessions. I start emacs and
lisp within screen at boot time via a custom screen config file launched
from a boot script.

Zach

Steve Allan

unread,
Jul 28, 2008, 5:25:34 PM7/28/08
to
Zach Beane <xa...@xach.com> writes:

I second that. Screen has saved me many times when I lose a remote
connection. Plus, its a multiplexer, which is pure gold when you're
running in a remote shell.

--
-- Steve

Rupert Swarbrick

unread,
Jul 28, 2008, 7:21:21 PM7/28/08
to
jingt...@gmail.com writes:

> This is probably a newbie question. And it might have more to do with
> ssh setup than lisp.
>
> I'm writing a web/app on a remote ubuntu server through putty. Usually
> I develop the code in an emacs/slime repl session open on the remote
> server. However sometimes the connection gets cut off (whether
> intentionally or not) and I will have to re-login the putty session.
> Checking the list of processes I can see that emacs is still running
> (sometimes it doesn't, not sure why). Is there anyway I can resume
> that emacs/repl session? (Currently, I just kill that old emacs
> process and start a new one and reload everything, which can be a
> pain.)

Others have pointed out screen, but I would suggest using Emacs' server
mode. I have the following in my .emacs:

;; Set gnuserve up and run it immediately ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'gnuserv-compat)
(require 'gnuserv)
(setenv "GNUSERV_SHOW_EMACS" "1")
(setenv "GNU_SECURE" "/etc/hosts.emacsallow")
(gnuserv-start)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


And emacsclient works fine for me. I presume that you would be able to
re-login to the putty session and use emacsclient to connect to the
(still running) emacs and slime sessions.


Rupert

Rob Warnock

unread,
Jul 29, 2008, 7:11:39 AM7/29/08
to
<jingt...@gmail.com> wrote:
+---------------

| However sometimes the connection gets cut off (whether
| intentionally or not) and I will have to re-login the putty session.
| Checking the list of processes I can see that emacs is still running
| (sometimes it doesn't, not sure why). Is there anyway I can resume
| that emacs/repl session?
+---------------

Others have mentioned "screen", but also have a look at:

http://www.cliki.net/detachtty

It lets you start server processes which don't even *have*
a controlling TTY initially, and then connect to them later
if you like [and then disconnect again]. I use it on the
listener (REPL) of CL-based web applications servers.
*Very* convenient...


-Rob

-----
Rob Warnock <rp...@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607

Petter Gustad

unread,
Jul 29, 2008, 7:47:33 AM7/29/08
to
rp...@rpw3.org (Rob Warnock) writes:

> Others have mentioned "screen", but also have a look at:
>
> http://www.cliki.net/detachtty
>
> It lets you start server processes which don't even *have*
> a controlling TTY initially, and then connect to them later
> if you like [and then disconnect again]. I use it on the
> listener (REPL) of CL-based web applications servers.
> *Very* convenient...

You can do that with "screen" as well. On my web server I have a
crontab entry which starts CMUCL under screen at reboot. It basically
does this:

screen -D -m -S aserve /usr/bin/lisp
-eval "(asdf:operate 'asdf:load-op :web)"
-eval "(mp:make-process #'web:start-web-server)"
-eval '(mp::startup-idle-and-top-level-loops)'

I can then do a "screen -r aserve" and then run swank:create-server
and slime-connect from emacs.

Petter
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Alexander Schmolck

unread,
Jul 29, 2008, 11:49:44 AM7/29/08
to
Zach Beane <xa...@xach.com> writes:

To give a simple cookbook example:

start emacs under screen (fixing the emacs-keybinding clashing default prefix):
> screen -e'^zz' emacs
detach with C-z C-d, then resume later with:
> screen -Udr

'as

jingt...@gmail.com

unread,
Jul 29, 2008, 5:29:53 PM7/29/08
to
Thanks a lot. I'm using screen with much success. I'm gonna try
detachtty next.

Rob Warnock

unread,
Jul 30, 2008, 6:42:10 AM7/30/08
to
Petter Gustad <newsma...@gustad.com> wrote:
+---------------

| rp...@rpw3.org (Rob Warnock) writes:
| > Others have mentioned "screen", but also have a look at:
| > http://www.cliki.net/detachtty
| > It lets you start server processes which don't even *have*
| > a controlling TTY initially...
|
| You can do that with "screen" as well. ...[example trimmed]...
+---------------

Yes, I know that. But then you're stuck with "screen", which
uses "[n]curses()" and thus messes up the scrollback of the
terminal [while providing its *own* peculiar scrollback, which
you can only do by going into "select" mode, which messes up
cut & paste through X Windows]. Sometimes I prefer that, but
usually it's a hassle and I prefer the (almost) naked pipe
that "detachtty" gives you. It's a matter of taste. YMMV.

0 new messages