SLIME Edits

I occasionally have trouble, while using SLIME, remembering which functions have been edited and compiled, and which ones have been edited but have not yet been recompiled. I wrote a little patch that hilights edits until something gets recompiled, and then removes whichever hilights are part of code that has been recompiled.

The following screenshots show how this feature works.

We start with a buffer containing a buggy definition of the factorial function, and a second function that just tests the first.

Now, after spotting the bug, we edit and fix fact. We also edit the test function to make its text a little prettier.

Pressing C-c C-c compiles the first function and removes its edit hilights (leaving the hilights in the second function, since that hasn't been recompiled yet).

Finally, pressing C-c C-c in the second function removes the remaining edit hilights. Note that C-c C-k would have had the same effect.

Here is a patch against the current (14th December 2005) CVS version of slime.el:

wjb@bills-laptop ~/slime $ cvs diff slime.el
Index: slime.el
===================================================================
RCS file: /project/slime/cvsroot/slime/slime.el,v
retrieving revision 1.568
diff -r1.568 slime.el
4203a4204
>   (slime-remove-edits 1 (point-max))
4264a4266,4270
>   (save-excursion
>     (beginning-of-defun)
>     (let ((start (point)))
>       (end-of-defun)
>       (slime-remove-edits start (point))))
4273a4280
>   (slime-remove-edits start end)
9852a9860,9886
>
>
> ;;;;; Hilight edits
>
> (defun slime-self-insert-command ()
>   (interactive)
>   (self-insert-command 1)
>   (let ((overlay (make-overlay (- (point) 1) (point))))
>     (flet ((putp (name value) (overlay-put overlay name value)))
>       (putp 'face '((italic) (background-color . "yellow")))
>       (putp 'slime-edit t))))
>
> (add-hook 'slime-mode-hook
>           (lambda ()
>             (dotimes (i 127)
>               (when (> i 31)
>                 (local-set-key (string i) 'slime-self-insert-command)))))
>
> (defun slime-remove-edits (start end)
>   "Delete the existing Slime edit hilights in the current buffer."
>   (save-excursion
>     (goto-char start)
>     (while (< (point) end)
>       (dolist (o (overlays-at (point)))
>         (when (overlay-get o 'slime-edit)
>           (delete-overlay o)))
>       (goto-char (next-overlay-change (point))))))