2010-03-05

Slime tidbits (2010-03-05)

In December 2009, Stas Boukarev and myself added some really cool stuff to the slime-asdf contrib, and while I've always wanted to blog about it, I just haven't come around doing so.
  • M-x slime-load-system (,load-system): Compile and load an ASDF system; that command currently hooks into the Slime compilation-notes machinery, so compilation notes, warnings, etc. will be collected and will end up in the *SLIME Compilation* buffer. This command has always been there, I just mention it for sake of completeness.
  • M-x slime-open-system (,open-system): Open all the files specified in the system.
  • M-x slime-isearch-system and M-x slime-rgrep-system: Run the command isearch and rgrep respectively on all the files specified in a system. That is particularly useful if slime-edit-definitions (M-.) and slime-edit-uses (M-?) won't do.

    In case of slime-rgrep-system, the commands next-error and previous-error will jump through the matches in the *grep* buffer. I bound those commands to F11 and F12, though by default they're also bound to M-g p and M-g n (also C-x `).
  • M-x slime-query-replace-system: Poor man's refactoring tool; run query-replace on all the specified files in a system. See this animated screenshot for an exemplary run. (Animated gif was generated on behalf of Zach Beane's Skippy library!)
  • M-x slime-query-replace-system-and-dependents: Like the former function, but also run query-replace on all the files of all systems depending on the user-queried system.
The latter two functions are really useful if you're past the initial state of something -- your system already grew to multiple files -- but still away from finishing and so you often want to rename identifier and slightly change APIs.

2009-11-12

Munich Lisp Talk, 10th November 2009

Last Tuesday, I gave short talk about a library I have been writing on: Sequence Iterators.
The library is perhaps a bit misnamed because at the moment, it's really a convenience layer on top of iterators. It's supposed to provide tools to make writing functions that operate on sequences convenient, and yet not blatantly inefficient.

I'd be very much interested in feedback regarding rough corners if you find a case to apply the library. If you want to give it a shot, there's a file "more-sequence-functions.lisp" which contain prototypes of useful sequence function for which I haven't yet had the time to write them.

Please notice that the library is still work in progress.

2009-10-31

Looking for a Lisp project?

You're an intermediate to the Common Lisp language and are desperately looking for a practical project to try your Lisp skills at? You're longing for fame and glory?

If that's the case, I have something for you:
  1. write a library to access the Web API provided by launchpad,
  2. afterwards, using that library, make it possible to conveniently add and update tickets in a (not yet existing) bug tracker for clbuild. The tickets are supposed to add/update repository urls.
Sounds interesting? If so, drop me a mail.

2009-10-24

SLIME tidbits (2009-10-24)

  • To quickly find out the "revision" of your slime checkout, you can now use M-x slime-changelog-date.
  • Sometimes, e.g. due to character encoding confusion, the Emacs side of Slime can be brought to a dysfunctional state. M-x slime-reset will hopefully get you back to business.
  • Restarts as shown in the Slime Debugger are now numbered reversely. The advantage is that often-existing restarts will now very likely get associated with the same number as you can see on the screenshot below. (Remember that the numeric keys are mapped to invoke the corresponding restarts.) This may mean that you have to invalidate some of your muscle memory -- notice that often-needed restarts do come with a static, symbolic mapping, i.e. q to abort to toplevel, a to invoke the most recently established abort restart, and c to invoke a continue restart.

  • Commands which open an Xref buffer (in particular M-?) do not select that buffer anymore. Instead, you're now supposed to use the commands C-M-. and C-M-, to cycle through the entries in the Xref buffer from within your source buffer. That's more ergonomic from my experience. The intended key sequence is: M-? C-M-. C-x 1 frob C-M-. C-x 1 frob etc.

2009-10-21

SLIME tidbits (2009-10-21)

Stas Boukarev just comitted two useful new commands to CVS: slime-open-system, and slime-browse-system.


As you can see on the above screenshot, M-x slime-open-system, or alternatively the REPL shortcut ,open-system, will open all the files listed in a system's .asd file. Optionally, it'll also load the system if it's not already loaded.

And on the screenshot below, you can see M-x slime-browse-system (or ,browse-system at the REPL, respectively) which will open the directory a system's .asd file lays in using dired.

2009-10-18

#0AFFFF

Common Lisp is a wonderfully complex language, and probably no matter how long you've been studying it, you'll always find a thing you didn't know before.

What, for example, do you think #0AFFFF represents?

Perhaps you're thinking of the color turquoise represented as a hexadecimal RGB value?

Well, witness for yourself:
CL-USER> (setf *read-base* 16)
16

CL-USER> #0AFFFF
#0A65535
(Bonus point if you know how to restore *READ-BASE* to a value of 10 again.)

Still no idea?
CL-USER> (type-of *)
(SIMPLE-ARRAY T NIL)
Right, #0AFOO is literal syntax for (make-array nil :initial-element 'foo).

And, yeah, even though Common Lisp is surely a complex beast, it's at the same time very well engineered. Witness thus:
CL-USER> (defvar *a*
           (make-array nil :initial-element 41))
*A*
CL-USER> (incf (aref *a*))
42
CL-USER> *a*
#0A42
And if you want to see really quirky stuff, take a look at strings with an element-type of nil.

2009-10-10

ANN: Named-Readtables 0.9

The editor-hints project is pleased to announce Named-Readtables.

What are Named-Readtables?

It's a library a) to help you to organize your readtable hacks, and b) to help your development environment to deal with these hacks. For detailed information see What are Named-Readtables? in the documentation.

Foretaste

DEFREADTABLE (analogously to DEFPACKAGE) can be used to specify the content of a readtable.

IN-READTABLE (analogously to IN-PACKAGE) can be used to specify what readtable should be used while compiling a .lisp file.

Named-Readtables has an API very much inspired by the existing API of packages. But see Important API idiosyncrasies in the documentation.

Documentation


See here.

Download

darcs get http://common-lisp.net/project/editor-hints/darcs/named-readtables/

Release Notes


The release was tagged as 0.9 even though it's actually pretty much a 1.0. Experience tells that no matter how much you try to polish a piece of software, there will be two to three issues. The 1.0 will wait for these issues be reported.

Implementations

The library has been tested on SBCL, CCL, Clisp, ABCL (head), ECL, Allegro 8.1, Lispworks 5.1.