welcome: please sign in

You can't save spelling words.

Clear message
location: MozRepl

The MozRepl extension embeds into Conkeror a JavaScript repl accessible via TCP connection to a port listening on localhost, usually 4242. In some cases, it may be more convenient than M-: and in particular, it includes an Emacs Lisp package that provides an inferior JavaScript shell interface to Conkeror using MozRepl (more information here).

Setup

After installing MozRepl, add one of the following blocks of code to your rc. The first will make the MozRepl server start at Conkeror's startup. The second will start the server immediately, and has the additional property of letting you easily customize the port it listens on.

user_pref('extensions.mozrepl.autoStart', true);

// Mozrepl
//
if ('@hyperstruct.net/mozlab/mozrepl;1' in Cc) {
  let mozrepl = Cc['@hyperstruct.net/mozlab/mozrepl;1']
    .getService(Ci.nsIMozRepl);
  if (! mozrepl.isActive())
    mozrepl.start(4242);
}

Environment Setup

Here is how to set up mozrepl to start in the Conkeror application context. That is the main context that contains all of Conkeror's global objects.

First make a file called ~/.mozrepl-conkeror.js, which contains the code that follows.

var conkeror = Cc["@conkeror.mozdev.org/application;1"]
    .getService().wrappedJSObject;

this.enter(conkeror);

Now put the following code into your .conkerorrc:

let (mozrepl_init = get_home_directory()) {
    mozrepl_init.appendRelativePath(".mozrepl-conkeror.js");
    session_pref('extensions.mozrepl.initUrl', make_uri(mozrepl_init).spec);
}

Conkeror.org: MozRepl (last edited 2011-01-12 17:48:53 by retroj)