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.)
jingtian...@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.
>> 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.
> 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.
+--------------- | 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:
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 <r...@rpw3.org> 627 26th Avenue <URL:http://rpw3.org/> San Mateo, CA 94403 (650)572-2607
> 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:
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?
>> 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):
Petter Gustad <newsmailco...@gustad.com> wrote: +--------------- | r...@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 <r...@rpw3.org> 627 26th Avenue <URL:http://rpw3.org/> San Mateo, CA 94403 (650)572-2607