LW-ADD-ONS

Table of Contents

[in package LW-ADD-ONS]

LW-ADD-ONS is a collection of small "enhancements" to the LispWorks IDE that I usually load from my initialization file. Most of this code is intended to make LispWorks behave similar to SLIME and GNU Emacs.

The details of what's included are outlined below. (Whether one thinks these are enhancements or rather distractions is of course a matter of taste.)

The code has been used and tested on LispWorks for Windows mostly (I don't use the IDE on Linux), but I hear there are also some Mac hackers using it successfully. For an overview of which LispWorks releases are supported, see Compatibility with different LispWorks releases section.

It comes with a BSD-style license so you can basically do with it whatever you want.

1 LW-ADD-ONS ASDF System Details

2 Compatibility with different LispWorks releases

LW-ADD-ONS was originally (in 2005) conceived and written for LispWorks 4.4.5/4.4.6 (and it will likely not work with older versions). Since then, the fine LispWorks hackers have added several new features to their IDE which rendered some parts of LW-ADD-ONS obsolete. As I usually use the latest LispWorks version, you can expect LW-ADD-ONS to be adapted to it pretty soon after its release. This might include dropping features which are now superseded by capabilities offered by the LispWorks IDE itself.

The newest LispWorks release which is currently supported is 7.0. Support for older LispWorks versions might at some point disappear. Keep your old LW-ADD-ONS tarballs if you plan on sticking with a certain LispWorks release.

3 Installation

To use LW-ADD-ONS you need LW-DOC and a recent version of LispWorks:

http://weitz.de/lw-doc/ http://www.lispworks.com/

Use of Quicklisp is recommended together with LispWorks distribution.

If you already have a LispWorks init file, append the included file .lispworks to it, otherwise instruct LispWorks to use this file as your initialization file. In that file, modify the special variables *ASDF-BASE-DIRS*, and *WORKING-DIR* to fit your local settings. Specifically, make sure that LW-ADD-ONS, LW-DOC and their supporting libraries can be found via *ASDF-BASE-DIRS*.

Download the HTML page http://www.lisp.org/mop/dictionary.html and store it locally. At the end of the init file (after LW-ADD-ONS has been loaded) set the value of LW-ADD-ONS:*MOP-PAGE* to the pathname of the saved HTML file. (There are some other special variables that can be used to modfiy the behaviour of LW-ADD-ONS. See the documentation for details.)

You should now be able to use LW-ADD-ONS by simply starting LispWorks.

Note: The Personal Edition of LispWorks doesn't support the automatic loading of initialization files. You'll have to use some kind of workaround.

4 Overview

Here's an overview of what's currently in LW-ADD-ONS. If you want more details you got to look at the source code which should be reasonably documented.

4.1 Symbol Completion

Symbol completion is divided into two editor commands. The "outer" command is Indent And Complete Symbol which tries to indent the current line and only performs completion if the line hasn't changed. I have bound this command to the TAB key in my init file, so I can use TAB for both indentation and completion. (In LispWorks 7.0 the editor command Indent Selection or Complete Symbol was introduced, so you probably no longer need my workaround.)

The "inner" command is Complete Symbol Without Dialog which is intended to work more or less like SLIME's SLIME-COMPLETE-SYMBOL* function, i.e. you can type, e.g., m-v-b and it'll be expanded to MULTIPLE-VALUE-BIND. If there's more than one possible completion, then the command only performs completion up to the longest unambiguous prefix and shows a list of (some of) the possible completions in the echo area. There's no GUI dialog popping up because I think that's distracting.

Indent And Complete Symbol calls Complete Symbol Without Dialog on LispWorks 4.4.x and 5.0.x. In 5.1, however, the new command Abbreviated Complete Symbol was introduced by LispWorks, so now you can decide which function should be used via the special variable *USE-ABBREVIATED-COMPLETE-SYMBOL*.

If it can be determined that you're within a string then Indent And Complete Symbol tries pathname completion instead. (This is not perfect, though, as it won't work if the string contains spaces.)

If the symbol which is completed denotes a function without arguments, Complete Symbol Without Dialog will automatically add a closing parenthesis. This can be customized through the variable *INSERT-RIGHT-PARENTHESIS-IF-NO-ARGS*.

You can customize the behavior of Complete Symbol Without Dialog by changing the value of the variable *COMPLETION-MATCH-FUNCTION*.

Note that for LispWorks 7.0 the default behavior had to be changed - see here.

These two commands are coming with LispWorks >= 7.0:

4.2 Information about the arguments of a function

The editor command Insert Space and Show Arglist which I've bound to the space key inserts a space and shows the argument list of the nearest enclosing operator in the echo area. If *SHOW-DOC-STRING-WHEN-SHOWING-ARGLIST* is true the documentation string of the operator is also shown.

Note that this command is different from the one that's distributed as an example together with LispWorks.

4.3 Apropos dialog

There is an Apropos dialog (see picture above) that can be reached via the LispWorks Tools menu or the Tools Apropos editor command (bound to C-c C-a):

The dialog should be mostly self-explanatory. Note that right-clicking on the results in the multi-column list panel (after selecting one or more items) pops up a menu with various options similar to other IDE tools. Double-clicking an item tries to find the corresponding source code or, failing that, the documentation.

Note that in LispWorks 5.0 a similar tool was introduced and it is bound to C-c C-a shortcut.

4.4 Transient mark mode

The editor tries to emulate GNU Emacs' transient mark mode if you bind the command Set Mark And Highlight to C-SPC and/or C-@.

This results in the marked region always being highlighted.

In LispWorks 7.1 standard Set Mark command works well in a transient mode by default and you don't need to rebind C-SPC to Set Mark And Highlight.

4.5 Search and replace

The editor commands to find and replace strings are modified in such a way that they only operate on the marked region if there is one. Also, the effects of a Replace... command can be undone with a single Undo command. (The latter feature comes for free with LispWorks 5.1 and higher.)

In LispWorks 5.0 and earlier, the editor command Continue Tags Search and all commands (like, say, Edit Callers) that make it applicable (see the LispWorks Editor User Guide) push the current position of point onto a definitions stack before they move to a new position. You can walk back through this "history" using the new editor command Pop Definitions Stack.

Note that in LispWorks 5.1 a new command Go Back was introduced, so the code related to the definitions stack is disabled for 5.1 and higher.

4.6 Online documentation

The editor command Meta Documentation (bound to F5 in the sample init file) tries to find HTML documentation for the symbol at point and immediately shows it using the default web browser. This applies to the HyperSpec, the LispWorks reference manuals, the MOP (see *MOP-PAGE*), and some other useful stuff, e.g. format strings like ~*, reader macros like #x, and loop clauses like loop:until.

Finally, HTML documentation for libraries like CL-PPCRE or LW-ADD-ONS itself that have Hyperdoc support will also be found.

TODO: Check how Hyperdoc works and maybe to support it in 40ANTS-DOC.

If the command is invoked with a prefix argument you are prompted for a symbol and completion is available.

Note that this command is similar although not identical to the undocumented LispWorks command Function Documentation.

4.7 ASDF integration

If *TRANSLATE-ASDF-SYSTEMS* is set to a true value then ASDF system definitions are automatically converted to Common Defsystem definitions whenever you load or compile an ASDF system.

Note that ASDF is a lot more flexible than Common Defsystem and there's no hope to convert every conceivable ASDF system to an equivalent Common Defsystem system. The conversion is mainly intended to enable you to browse ASDF systems from the LispWorks IDE and use editor commands like System Search and System Query Replace. It seems to work in practice for a lot of open source ASDF systems that can be used with LispWorks.

Note that this has been rendered mostly obsolete due to a new feature in LispWorks 6.1 and has been disabled for LispWorks 7.

4.8 Quicklisp integration

LW-ADD-ONS contains Quicklisp support.

Download http://beta.quicklisp.org/quicklisp.lisp and load it. Installation is self-explanatory, simply follow the instructions. Do not let Quicklisp write anything into init files.

4.9 Listener shortcuts

Similar to SLIME's slime-handle-repl-shortcut you can press , (comma, for Maybe Invoke Listener Shortcut) in the listener and then choose from a couple of shortcuts (see *LISTENER-SHORTCUTS*) to perform administrative tasks like loading a system via ASDF or changing the current directory.

Type F1 when prompted for a shortcut to see a list of what's available.

Currently there are shortcuts for:

See the documentation strings of these commands for details.

If Quicklisp is used, the first is changed to

and loading with ASDF is changed to:

If you don't like this change and want the old behavior while using Quicklisp simply switch *USE-QUICKLISP-FOR-SHORTCUT-L* to NIL.

4.10 Alternative editor backups

LW-ADD-ONS can alter the way the IDE editor creates pathnames for backups. This might come in handy if you don't want your code directories to be cluttered with files like foo.lisp~. Read about *MAKE-BACKUP-FILENAME-FUNCTION*, MAKE-BACKUP-FILENAME-USING-BACKUP-DIRECTORY, and *BACKUP-DIRECTORY* and set these to values suiting your needs.

4.11 Miscellaneous

The command Next Ordinary Window (usually bound to C-x o) is modified to also allow switching from an editor window to a listener window.

The command Find Alternate File (usually bound to C-x C-v) is modified such that it checks whether the contents of the buffer are consistent with the file on disk. Also, it'll provide the full pathname of the current buffer as the default when prompting.

The command Indent And Complete Symbol includes a workaround to make sure that the start of a top-level form will always be indented to the beginning of a line. LispWorks usually doesn't do that.

The commands Evaluate Last Form And Inspect (C-c i) and Evaluate Last Form And Describe (C-c d) are like Evaluate Last Form but open the result in an IDE inspector or describe it in a help window respectively.

The command Untrace All executes (untrace), the command Toggle Trace (C-c C-t) traces or untraces a function depending on its current state.

The included initialization file makes sure you start with an editor and (if you use the MDI interface) tiles the windows vertically.

A DDE Server as described in the LispWorks Knowledgebase is set up so you can open Lisp source files by double-clicking them. You have to configure Windows Explorer to use this facility, of course.

The function keys F11 and F12 are bound to commands that switch to an editor or a listener respectively (and create these tools if necessary).

5 Acknowledgements

The inhabitants of the LispWorks mailing list are an invaluable source of information when one writes LispWorks-specific code. Specifically, Jeff Caldwell, Bill Clementson, John DeSoi, Dmitriy Ivanov, Arthur Lemmens, Nick Levine, Sean Ross, Jens Teich, Barry Wilkes, and (from LispWorks Ltd.) Dave Fox and Martin Simmons have been very helpful in various ways.

Thanks also go to the cool SLIME project which provided inspiration and code to steal.