SLIME-PPCRE
This is a contribution to SLIME that allows for finding and replacing regexps using cl-ppcre (you need iterate too) in all the source components of a specific asdf system, or all systems known to asdf::*defined-systems* or, finally, a given list of systems.

Finding

When finding a regexp in a specific system (C-c f s), you will be prompted in the minibuffer:

Regexp: compiler-macro

then

System: cl-ppcre (with completion)

and then the results will be shown in a *grep* buffer:

-*- mode: grep; default-directory: "~/" -*-
Grep started at Mon Aug 27 10:15:32

cd /Users/cl-user/;mkfifo /tmp/slime-ppcre.fifo;cat /tmp/slime-ppcre.fifo
arch/lisp/cl-ppcre/api.lisp:283: (define-compiler-macro scan (&whole form &environment env regex target-string &rest rest)
arch/lisp/cl-ppcre/api.lisp:316: (define-compiler-macro scan-to-strings
arch/lisp/cl-ppcre/api.lisp:529: (define-compiler-macro all-matches (&whole form &environment env regex &rest rest)
arch/lisp/cl-ppcre/api.lisp:552: (define-compiler-macro all-matches-as-strings (&whole form &environment env regex &rest rest)
arch/lisp/cl-ppcre/api.lisp:633: (define-compiler-macro split (&whole form &environment env regex target-string &rest rest)
arch/lisp/cl-ppcre/api.lisp:1000: (define-compiler-macro regex-replace
arch/lisp/cl-ppcre/api.lisp:1061: (define-compiler-macro regex-replace-all

Grep finished (matches found) at Mon Aug 27 10:15:33

Replacing

In the case of replacing a regexp (C-c r s), you will simply see in how many files replacements were made.

Key Bindings

Here is a list of the current bindings:

  • ("\C-cfs" . slime-ppcre-find-regex-system)
  • ("\C-cfa" . slime-ppcre-find-regex-systems-all)
  • ("\C-cfv" . slime-ppcre-find-regex-systems-variable)
  • ("\C-crs" . slime-ppcre-replace-regex-system)
  • ("\C-cra" . slime-ppcre-replace-regex-systems-all)
  • ("\C-crv" . slime-ppcre-replace-regex-systems-variable)

Installation

Installing is as easy as putting slime-ppcre.el and swank-ppcre.lisp into slime/contrib and then adding

(add-hook 'slime-load-hook (lambda () (require 'slime-ppcre)))

to your .emacs.

Right now, I also had to change swank-loader.lisp:

(defvar *contribs* '(swank-fuzzy swank-ppcre)
  "List of names for contrib modules.")

Download

The repo is at http://kiliansprotte.de/darcs/slime-ppcre/
darcs get http://kiliansprotte.de/darcs/slime-ppcre/


See also:

SLIME