Skip to content
This repository has been archived by the owner on Aug 19, 2021. It is now read-only.

Emacs integration

bard edited this page Nov 19, 2011 · 8 revisions

Download moz.el and place it in Emacs’ load-path. Alternatively, place it in any directory (e.g. “/home/user/emacsfiles”) then add that directory to the load-path, as follows:


    (add-to-list 'load-path "/home/user/emacsfiles")

moz.el contains a major mode for direct interaction with MozRepl in an interaction buffer (as with telnet) and a minor mode for sending code portions or whole files from other buffers.

Add this to your .emacs file:


    (autoload 'moz-minor-mode "moz" "Mozilla Minor and Inferior Mozilla Modes" t)

    (add-hook 'javascript-mode-hook 'javascript-custom-setup)
    (defun javascript-custom-setup ()
      (moz-minor-mode 1))

Restart Emacs, and every time you open a Javascript file, you will now have the following keybindings available:

  • C-c C-s: open a MozRepl interaction buffer and switch to it
  • C-c C-l: save the current buffer and load it in MozRepl
  • C-M-x: send the current function (as recognized by c-mark-function) to MozRepl
  • C-c C-c: send the current function to MozRepl and switch to the interaction buffer
  • C-c C-r: send the current region to MozRepl

In the interaction buffer:

  • C-c c: insert the current name of the REPL plus the dot operator (usually repl.)

Tips & tricks

The predictive abbreviation mode is very handy when working in Javascript source buffers.