From J Wiki
Jump to navigation Jump to search
Emacs showing some J code in a buffer above and the console in the buffer below

J definitions are in text files and can be edited with any editor. Jconsole has no native editor and you use the editor of your choice: a simple editor such as Windows notepad (or Unix equivalent), or a more powerful editor such as Emacs.

A J project typically consists of a small number of small files and a simple editor is quite adequate and Emacs is overkill. However, if you already know and love Emacs, you may sorely miss it when in J.

There are two j-modes available: one from Alexander Schmolck (2007) and one from Zach Elliot (2012). If you use MELPA to install Emacs packages, you will get the J Mode by Zach Elliot.


Both modes are in a source file called j-mode.el. When Emacs j-mode.el gives an interactive buffer called *J* with which to interact with J. This is where J code can be typed or sent from other buffers.

Both modes feature syntax-highlighting and execution of code regions (current function, line, the entire buffer).

The older mode by Alexander Schmolck also offers help browsing and vocabulary look up for the word at point, syntax-aware code indentation, as well as support for plotting by not using ijconsole (or jconsole) but jee (but where do you get jee?).

Zach Elliot's J Mode

You should install this mode using MELPA. This will make sure everything is set up correctly.

Files ending in .ijs will automatically use J Mode.

  • C-c C-c sends the whole buffer to the console
  • C-c C-r sends the region to the console
  • C-c C-l sends the current line to the console

Use M-x j-console to open a console without sending anything.

If your console is called jconsole instead of ijconsole, change the default in your init file:

    (setq j-console-cmd "jconsole")

A fork by LdBeth


The syntax highlighting has been substantially reworked for better handling multiline definitions and is up to date with NuVoc. Support for J labs has been added. User feedbacks and comments are welcome.

Alexander Schmolck's J Mode Installation

The j-mode.el installation instructions say:

1. Copy j-mode.el to a directory in your emacs load-path.

2. Add the following to your .emacs file or site-init.el:

    (autoload 'j-mode "j-mode.el" "Major mode for J." t)
    (autoload 'j-shell "j-mode.el" "Run J from emacs." t)

One possible problem is that you don't have a .emacs file. Use Emacs to create it as follows:

emacs ~/.emacs

Another problem is knowing where to put j-mode.el; traditionally you would create a directory such as ~/elisp, but the file there, and add that directory to your load-path:

    (add-to-list 'load-path "~/elisp")
    (autoload 'j-mode "j-mode.el" "Major mode for J." t)
    (autoload 'j-shell "j-mode.el" "Run J from emacs." t)