SLip

A Lisp environment for the browser.

Open demo
Note, the demo requires you to enable popups for this website.

“IDE” information

SLip includes a development environment based on Ymacs, aiming to provide features similar to SLIME and Emacs (well, we're pretty far from them yet). Most of SLip was developed in this environment. From it you can edit files and save them via WebDAV (needs special configuration in your Web server), you can evaluate Lisp expressions or you can compile an entire file to “fasl”. It also provides a REPL. I'm gonna call it the “IDE”, though it's not an IDE in the classical sense.

On startup the IDE pops up in a new window (so you need to enable popups), and keeps the page where SLip itself is running blank. I decided to do it this way so that I don't pollute the DOM of the SLip application with the IDE. The editor is able to send Lisp commands to that page, and get back the results.

Basic keybindings

Emacs users should feel familiar with this environment. I'm listing here key bindings that are specific to the SLip mode; you can find info on Ymacs keybindings elsewhere.

C-x C-f Open file. You'll have to type the file name here (completion unavailable, unfortunately). The names are relative to the path of “index.html” from the SLip tree, so for example to open the compiler you'd type “lisp/compiler.lisp”. If you type a non-existent file name, you'll get an empty buffer and that file will be created when you save it via C-x C-s.
C-x C-s Save the current buffer.
C-c C-c or C-M-x Evaluate toplevel expression.
C-c C-k Evaluate entire buffer.
C-c C-r Evaluate region.
C-c ENTER Macroexpand expression at cursor. The output goes in the *sl* buffer.
C-c M-m Macroexpand-all the expression at cursor.
M-q Reformat (indent) toplevel expression.
S-TAB Complete symbol at point.
M-. Locate symbol definition if available. By default when you compile an entire file, several constructs will make the compiler insert cross-reference information in the FASL. Following macros provide this currently: defun, defmacro, defparameter, defglobal. We don't yet have SLIME's more advanced x-ref information, like “who calls”, “who references”, “who macroexpands”—but those could be added fairly easily.

In the REPL buffer (“*sl*”) there are additional bindings:

ENTER When the cursor is after the last prompt, ENTER will evaluate the expression in the REPL. When the cursor is before the last prompt, ENTER will copy the toplevel expression into the prompt.
C-ENTER Newline and indent
M-p or C-ARROW_UP Previous line from history. This functions as a search if the prompt input wasn't empty, so if you need, say, previous history line that contains “defun”, just type “defun” into the REPL and press M-p.
M-n or C-ARROW_DOWN Next line from history; also search.
C-DELETE Delete the current input, leaving the prompt empty
TAB Complete symbol at point
C-c M-o or C-c DELETE or C-c C-DELETE Clear the *sl* buffer, leaving an empty prompt.

Packages

The editor understands the standard way to declare the current package—(in-package :foo)—which is necessary when you evaluate an expression in the editor in order to know which package to read that expression in. Also, TAB completion shows only symbols that are available in the current position.

To change the package in the REPL, you can evaluate i.e. (in-package :foo).

Compiling whole files

Although there is C-c C-k to compile the whole buffer, this doesn't save the FASL anywhere and will not produce cross-reference information. To compile a whole file and save the FASL there's the command M-x ss_compile_file (you need to save the file first in order to catch any changes!).

Sometimes it's necessary to rebuild all the files (for example when you add/modify a compiler feature, you want to recompile all files, including compiler.lisp, in order for them to use the new version of the compiler). To do this you can M-x ss_recompile_everything. To tweak what files are included here you need to edit ide/boot-ide.js (search for “lisp_files”).

Fork me on Github