You *could* implement the whole thing in emacs lisp and have a little daemon running that's run from inetd which spawns a new emacs instance and connects you to it across the internet.