mozrepl.el 856 B

12345678910111213141516171819202122232425262728293031
  1. ;; --------
  2. ;; Mozrepl
  3. ;; --------
  4. (load-file "~/.emacs.d/modes/moz.el")
  5. (require 'js2-mode)
  6. (require 'moz)
  7. (require 'json)
  8. (defun moz-update (&rest ignored)
  9. "Update the remote mozrepl instance"
  10. (interactive)
  11. (comint-send-string (inferior-moz-process)
  12. (concat "content.document.body.innerHTML="
  13. (json-encode (buffer-string)) ";")))
  14. (defun moz-enable-auto-update ()
  15. "Automatically the remote mozrepl when this buffer changes"
  16. (interactive)
  17. (add-hook 'after-change-functions 'moz-update t t))
  18. (defun moz-disable-auto-update ()
  19. "Disable automatic mozrepl updates"
  20. (interactive)
  21. (remove-hook 'after-change-functions 'moz-update t))
  22. (autoload 'moz-minor-mode "moz" "Mozilla Minor and Inferior Mozilla Modes" t)
  23. (add-hook 'javascript-mode-hook 'java-custom-setup)
  24. (defun javascript-custom-setup () (moz-minor-mode 1))