From: ···········@gmail.com
Subject: How to resume a remote repl session? and edit running code?
Date: 
Message-ID: <94c20b56-6c51-4028-aeb7-20c05aaf5c6b@k36g2000pri.googlegroups.com>
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.)

From: Zach Beane
Subject: Re: How to resume a remote repl session? and edit running code?
Date: 
Message-ID: <m33altg4b7.fsf@unnamed.xach.com>
···········@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
From: Steve Allan
Subject: Re: How to resume a remote repl session? and edit running code?
Date: 
Message-ID: <uabg1r99t.fsf@attachmate.com>
Zach Beane <····@xach.com> writes:

> ···········@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.

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
From: ···········@gmail.com
Subject: Re: How to resume a remote repl session? and edit running code?
Date: 
Message-ID: <7a7e6b15-1745-4432-9290-eb0fb8080b87@w39g2000prb.googlegroups.com>
Thanks a lot. I'm using screen with much success. I'm gonna try
detachtty next.
From: Alexander Schmolck
Subject: Re: How to resume a remote repl session? and edit running code?
Date: 
Message-ID: <yfsk5f4ellz.fsf@gmail.com>
Zach Beane <····@xach.com> writes:

> ···········@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.

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
From: Rupert Swarbrick
Subject: Re: How to resume a remote repl session? and edit running code?
Date: 
Message-ID: <g6lk9k$7kt$1@news.albasani.net>
--=-=-=

···········@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

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iJwEAQECAAYFAkiOVHEACgkQRtd/pJbYVoaJcQP7BSZsLYbcbDzcb+agzG7Z/KjA
jSt3MK2M7rZ0b9Orkb6nNy7N8yp2LMxkUL77doa4yZY0FeGDTOvaC0nFAePWj3Zv
3wbgmZiVQtGcQd2/VGjmNdm9PnC05Vm2lOvpKWqESGv34xVvR+0W5DcOQUq0bRCp
J8LSpbTM+0ARL4/j2QA=
=obAT
-----END PGP SIGNATURE-----
--=-=-=--
From: Rob Warnock
Subject: Re: How to resume a remote repl session? and edit running code?
Date: 
Message-ID: <-6KdnSvMvLl2ZxPVnZ2dnUVZ_t7inZ2d@speakeasy.net>
<···········@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			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Petter Gustad
Subject: Re: How to resume a remote repl session? and edit running code?
Date: 
Message-ID: <877ib4syi2.fsf@pangea.home.gustad.com>
····@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?
From: Rob Warnock
Subject: Re: How to resume a remote repl session? and edit running code?
Date: 
Message-ID: <a_6dnZTslNsf2A3VnZ2dnUVZ_qrinZ2d@speakeasy.net>
Petter Gustad  <·············@gustad.com> wrote:
+---------------
| ····@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.


-Rob

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