README 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. Servers
  2. =======
  3. Because the Chrome(ium) security model doesn't allow for extensions
  4. spawning processes we can't just exec() the editor process. Instead we
  5. have to implement an "edit server" which listens to XmlHttp requests
  6. on port 9292 (default) and then sends a response when the edit is
  7. complete. We include a couple here:
  8. * pycl.py - Original version, only edit one file at a time
  9. * edit_server.el - An native Emacs Lisp implementation
  10. There is another project called TextAid which does a similar thing to
  11. Edit with Emacs. It's edit server is implemented in perl and be found
  12. at:
  13. * http://opencoder.net/edit-server
  14. As the edit server concept is fairly simple we will try and keep them
  15. compatible with each other.
  16. Customizing the look of Emacs
  17. =============================
  18. By default, Emacs opens up a new frame upon an edit request. All the
  19. UI elements are removed to better mimic a bare text box. You can
  20. customize the default behavior by `M-x customize-group [RET]
  21. edit-server [RET]`. Or you can set the variables' values directly in
  22. your ~/.emacs.
  23. Hooks
  24. =====
  25. edit-server.el provides two hooks for customising behaviour when edit
  26. requests are being made. These are:
  27. * edit-server-start-hook - called when editing starts
  28. * edit-server-done-hook - called when just before the text returned
  29. We now include edit-server-htmlize.el which provides some example
  30. functions which can be added to these hooks to deal with a popular web
  31. based email client which sends HTML even in plain text mode.
  32. How it works
  33. ============
  34. The browser sends a request to the edit server of the form:
  35. http://${HOSTNAME}:${HOSTPORT}/${CMD}
  36. HOSTNAME is usually localhost, i.e. 127.0.0.1
  37. HOSTPORT is the server port, in our case defaults to 9292
  38. CMD is the command to the edit server, it may be one of the following:
  39. * edit
  40. The edit command is sent as an HTTP POST request. After the headers
  41. the data is the current contents of the text area.
  42. Once the edit is complete the server sends an HTTP 200 (OK) response
  43. with the data containing the new text area text. Any other response
  44. will result in the text area not being updated.
  45. The extension also sets some headers which may be used by the edit
  46. servers to create more identifiable names for the buffers/temp files
  47. to help the user keep track.
  48. x-url: The URL of the source page
  49. x-id: The unique (on the page) ID of the text area
  50. * status
  51. The status command is sent as an HTTP GET request. The intention is to
  52. use it as a simple test for the status of Edit Server and to be used
  53. as a "Are you there?" test.
  54. The response is basically a text string describing the state of the
  55. edit server.