Perl interface to SLIME

SLIMPL -- A Perl interface to SLIME

Champion

Larry Clapp

Proposal

Write a Perl module to talk to Swank, the SLIME backend, with the eventual intention of writing a Vim interface to SLIMPL, allowing Vimmers everywhere to use SLIME.

Lots of people apparently would like to try Lisp, and would like a nice IDE, and like (or at least know and have installed) Vim, and don't care to learn/use Emacs. SLIMPL / SLIM-Vim would ease that particular barrier to entry.

NOTE: We've put this project on hold. Read on for why ...

Q: Why not add ECL or clisp to Vim, and then port slime.el to Common Lisp?
A: That'd be a great (big) project -- for someone else. Update (7 Mar '06): It turned out to be not such a big project after all. Jim Bailey did it (with ECL) in two days. As a result, the Slimpl mailing list has more-or-less agreed to try to port Slime to Common Lisp. We haven't created a page for that yet.

Q: Why not just write another vi-alike in Common Lisp?
A: That's a much bigger project than embedding ECL into Vim, much less just making Vim talk to Swank. See also below.

Goal

To provide a Vim extension to interface with the Swank backend, allowing integrated debugging of a Lisp image with Vim. Ideally the extension should work with a stock standard Vim. We want to lower the barrier of entry to Vimmers (or vi-ers, or just to I-don't-want-to-install-emacs-ers), not just have an editor with vi-like key bindings that can talk to Swank. If we merely wanted that, we'd tweak Emacs's Viper mode and have done.

Volunteers

Tasks

Larry
TODOs
  • Add support for the Swank debugger
  • Submit project to the Gardener's list for Planting.
Brad
To do:
  • Get this page into a state that can be blessed by the Green Thumbs committee.
  • Test SLIMPL.
Eirik
To do:
  • Write vim help file for vim+ecl.
Anybody
To do:
  • Emacs has an asynchronous interrupt facility, Vim doesn't. The closest things I (Larry) can find in Vim to asynchronous interrupts are the CursorHold and RemoteReply events. Interested parties can poke around the Vim help files, source code, news groups, etc, and see if I've missed something, or think about how to implement some sort of poor-man's cooperative multitasking within Vim. For example, we might map the cursor movement keys (hjkl, etc) and all the normally-self-inserting keys (a-z0-9(), etc) to first call the SLIM-Vim event handler. Other suggestions welcome.
  • If someone wants to dig around the Vim main event loop and figure out how to do a real periodic asynchronous event, that'd be way cool, too.
  • There is a list of Slime keymappings, these are probably the functions that we need to emulate. SLIMPL Useful slime funcs
  • Points below here simply scraped from one of Larry's emails.
  • An event system of some kind. The list has discussed this before, so several ideas for this exist. I just want someone to complete it, document it, and package it as a stand-alone Vim module. Requirements: I would need to register a Vim function that will get called periodically. Ideally the end-user could specify the period.
  • An interface to the Hyperspec, ideally something that interfaces with Vim's tag system in a sane way.
  • My VILisp has an interface that works for me, but I've gotten little feedback about whether it works for other people. If someone would like to play with it on other operating systems and browsers and report bugs, that would help me improve it. See http://www.vim.org/scripts/script.php?script_id=221.
  • A script to convert the Hyperspec to a Vim help file. (We can't just re-release the Hyperspec as a Vim help file, so far as I can tell; I think that would count as a "derivative work".) Such a script may already exist for general HTML. Great; point us to it!
  • Sytax highlighting for a slimpl debugger window. (This will have to wait until I *have* a slimpl debugger window, but it's waiting in the shed. (I initially wrote "in the wings", but "in the shed" works better with the gardening metaphor. :))
  • Testing on other operating systems / versions of Perl / versions of Vim / versions/implementations of Lisp. I've done the vast majority of my testing on Debian Linux with Vim 6.4, Perl 5.7/5.8, and clisp 2.33. For the foreseeable future, I plan to test against "a recent CVS snapshot of Slime", which I'll update every so often, so no need to test earlier versions of that.
  • Documentation on the slime/swank interface. This needn't mention Slimpl at all, of course, and might get us a few warm fuzzies from the Slime team.
  • A REPL mode for Vim. I envision this as a mostly-normal editor buffer, except that you can't make changes above the last expression (if you try to, the editor should automatically copy the current expression to the last line and start editing it there), and if you press a certain key, it calls a function (which will call Slim-Vim to evaluate the expression and return a result).
  • Someone to scrutinize Vim's indentation system and a) tell us how to tweak it for best results, b) write an indent-expression that adjusts indentation properly, and/or c) tell us how to hook Slim-Vim into it. For example, Vim doesn't, by default, indent FLET expressions very well: (flet ((some-long-function-name () (expr))) ...)
  • Write a Vim function that looks at the current cursor position and returns true if it's in a Lisp comment. This would help with extracting "the current expression" from the buffer. Currently I use the % operator, which doesn't ignore text in comments, so if you have "(foo" or an emoticon in a comment it breaks Slim-Vim (and VILisp, for that matter).

Green Thumbs would like to see:

Brad Thinks:

Latest status

We have a basic module and Vim interface that allows you to send an expression to Lisp and get a result back. There's also a rudimentary Perl REPL, but it's just for testing and experimentation.

Note: There is no debugger support yet. If you get an error or condition or invoke the debugger in some other way, you'll probably have to kill your Lisp and restart it. You may also crash or hang your Vim.

The current code works under Linux and Windows (both Cygwin and native Windows). You must have a Perl-enabled Vim. See the README.

Thanks to Peter Seibel, we now have our own mailing list. Subscribe and view the archive at http://www.lispniks.com/mailman/listinfo/slimpl.

Download a SLIMPL tarball at http://www.theclapp.org/slimpl/. View the README at http://www.theclapp.org/slimpl/README.txt

Download a Perl (and X11 and gtk2) enabled Vim for Windows+Cygwin+X11 at http://www.theclapp.org/slimpl/vim.exe.

Resources

Categories

Gardeners Projects