

Ask HN: How would you make Emacs do this? - abstractbill

For a long while now I've only used two applications almost all the time - a web browser, and Emacs.  For reasons I can't quite explain but feel strongly about, I'd love to get that down to just one.<p>So I have the idea of being able to have a web site that's actually just a gateway to an Emacs instance running on one of my servers.<p>I don't have a problem imagining how I might do the web app itself - it would probably use html/javascript for presentation, and then a small piece of Flash code to give me a real tcp socket that I can use to talk to Emacs.  No problem - I can do these kinds of things easily.<p>It would be useful to open and save-to <i>local</i> files in addition to ones already on the server.  Again, using a little bit of Flash 10, I can make that happen easily.<p>Now the frontend needs to tell Emacs, via this socket, whenever the user presses a key.  And Emacs in turn needs to tell the web app to update the display.  I could easily decide on a simple socket protocol for these things.<p>But on the backend I don't have much idea at all - I've modified my own .emacs a bunch, but I've never actually hacked Emacs.<p>Does anyone have any pointers?  Should I model this after an existing display toolkit (like motiff, gtk, etc)?  Or would a different approach work better?  Should I start writing this in ELisp, or am I very likely to actually need to drop down to C for some reason?
======
silentbicycle
I don't see why it would really be beneficial - People who want to connect
with a remote Emacs session just use ssh + screen or tmux, which is stable and
quick to set up. If you really want to implement Emacs-over-the-web, though,
familiarity with these might help:

distel - distributed elisp, via integration with Erlang
(<http://fresh.homeunix.net/~luke/distel/>)

TRAMP - remote file editing (See e.g.
<http://www.emacswiki.org/emacs/TrampMode>)

Also, there are decent web browsers for Emacs. I like emacs-w3m.
(<http://emacs-w3m.namazu.org/>)

------
jimm
How about the opposite: browse the Web from within Emacs?
<http://www.emacswiki.org/emacs/emacs-w3m>

[Edit: link to W3M, not the older W3]

------
ianb
I've been thinking about this too
([http://blog.ianbicking.org/2010/05/04/browser-desktop-
develo...](http://blog.ianbicking.org/2010/05/04/browser-desktop-developer-
tools/)) -- but I figured I'd just let go of Emacs in the process, presumably
to replace it with Bespin: <http://mozillalabs.com/bespin> \-- it is purported
to have some Emacs keybindings (I haven't been able to enable them though).

------
icey
Hmm. Perhaps one of these would make a decent starting point?

<http://antony.lesuisse.org/software/ajaxterm/>

<http://anyterm.org/>

<http://testape.com/webtty_sample.php>

------
tonyarkles
You could look at Web Sockets (<http://en.wikipedia.org/wiki/Web_Sockets>). I
know Chrome supports it, not sure about other browsers. A friend made a very
cool interactive multi-user app using this and was quite impressed at the
responsiveness.

------
marcmarc
You can control Firefox from emacs using MozRepl. This extension allows you
execute code on the browser. For example, you can tell emacs to refresh a
specific tab when an html file is saved. MozRepl is not the only extension
doing that. There are 4 or 5 similar projects.

More info <http://www.emacswiki.org/emacs/MozRepl>

------
simplify
I think it would be useful as, say, a chrome plugin. A hotkey to open up a new
emacs tab right next to my webpage tabs would be nice.

------
positr0nic
How about something like this? <http://nomachine.com/web-player.php> Saving
files locally might not be straight forward though.

------
j_baker
For editing remote files, I find that sshfs is extremely useful:
<http://en.wikipedia.org/wiki/SSHFS>

~~~
abstractbill
To clarify, I don't have a problem editing remote files - I use TRAMP right
now (haven't tried sshfs, but it looks interesting thanks!).

The problem I'm trying to solve is that right now I need to install Emacs on
any computer I want to do work on. I'd like to be able to jump onto a random
friend's laptop and open Emacs without _any_ setup cost.

