Lisppaste - an interesting program
Wednesday, October 20, 2004
I discovered the other day that Brian Mastenbrook's efforts to port the Araneida web server to multiple Lisp implementations meant that I can now use Araneida on Win32. Since then, I've been having a play with some Araneida-based code. One particularly interesting project is Lisppaste, a paste bot written in CL. Now (unless you frequent the #lisp IRC channel), you're probably wondering "what the #@*! is a paste bot?". Well, the short answer is that it provides IRC users with a convenient mechanism for sharing code/text with other IRC users; however, it does much more than that. It's probably easier to give an example than to try to explain:
- An IRC user wants to share a snippet of code or text (due to the limitations of IRC, this is not very easy to do using just IRC). To do this via Lisppaste, he/she enters the code/text via an HTML page (see the one hosted on common-lisp.net here).
- After the user presses the "Submit paste" button, a message is sent to the specified IRC channel (see example here) with a user name of "lisppaste". The IRC message includes the IRC user name of the person who pasted the code as well as a brief description and a URL link to the paste. (Note: it is not necessary to select an IRC channel if you just want to send a link to someone via email - you can just save the paste with a channel of "None".)
- Anyone on that IRC channel can select the URL and view the paste (see the paste here).
- On the header of the paste, there is a link to the location in the IRC channel log where the paste notification was made (for example, on this paste, you would click on the link "Context in IRC logs" to go to the #lisp IRC log location). This is useful if you are sent the link to the paste by someone and want to see the context (e.g. -- discussion) that lead up to (or followed) the paste.
- If the original paster (or anyone else) wants to add annotations to the paste, they can click on the "Annotate this paste" button and add additional text (for example, there is an annotation at the bottom of this paste). After adding an annotation, another message is sent to the IRC channel indicating that an annotation has been made.
In addition to what is covered in the use case described above, Lisppaste also provides the following functionality:
- Colorization of source code according to any of the following:
- None: no colorization at all.
- Basic Lisp: Colorization of Lisp code but no key word links.
- Scheme: Colorization of Scheme code with key word links to the R5RS document. (Example here: click on one of the green key words to get the R5RS documentation for that key word.)
- Emacs Lisp: Colorization of Elisp code with key word links to the Elisp Reference Manual. (Example here: click on one of the green key words to get the Elisp documentation for that key word.)
- Common Lisp: Colorization of CL code with key word links to the Hyperspec. (Example here: click on one of the green key words to get the Hyperspec documentation for that key word.)
- C, C++, Java: Colorization of C, C++ or Java code.
Your xxx.lisp file will be colorized in xxx.html. Incidentally, the above 3 lines were colorized in this manner! :)(asdf:operate 'asdf:load-op :lisppaste)
(in-package :colorize)
(colorize-file :common-lisp-file "xxx.lisp")
- Listing of recent pastes from all sources.
- Ability to use XML-RPC to programmatically send code/text to Lisppaste instead of manually entering/pasting it.
- An RSS feed of the Lisppaste pastes.
- A page of Lisppaste Statistics for those of us who like numbers. ;-).
- Araneida web server: In addition to page hosting, Araneida is used internally for certain request/response and URL functionality, so use of an alternative web server is not an option at the moment.
- CL-IRC: The CL-IRC package is used for sending IRC messages to the nominated IRC channel to notify people when a paste has been saved.
- SPLIT-SEQUENCE: The SPLIT-SEQUENCE package is used to split sequences (duh!).
- S-XML and S-XML-RPC: The S-XML and S-XML-RPC packages are used for XML parsing and XML-RPC handling.
- Meme: Although Meme is not a required component, Lisppaste directly links to Meme logs, making it very convenient to use Meme as a non-interactive IRC reader.

