From: john
Subject: Refactoring in Lisp
Date: 
Message-ID: <e6001c6e.0209100512.708368c8@posting.google.com>
Hello,

Is there any library or tool which enables in CL/CLOS some simple
refactorings on source code as rename of symbols for functions,
variables, macros, packages etc?
Using just a text editor I have to search for every occurence of the
old name (of function, macro or variable) and check if it is in the
correct scope or is it the right type of symbol and then decide to
replace it with the new name. This is sometimes tedious.
If this matters, I'm using LispWorks. There is something which helps
in restricted range of errors - you can select a function and see all
places where it gets called from.

Thank you in advance

From: Carl Shapiro
Subject: Re: Refactoring in Lisp
Date: 
Message-ID: <ouyk7lu3qu5.fsf@panix3.panix.com>
·········@yahoo.com (john) writes:

> Hello,
> 
> Is there any library or tool which enables in CL/CLOS some simple
> refactorings on source code as rename of symbols for functions,
> variables, macros, packages etc?

Of course!

> Using just a text editor I have to search for every occurence of the
> old name (of function, macro or variable) and check if it is in the
> correct scope or is it the right type of symbol and then decide to
> replace it with the new name. This is sometimes tedious.

If you are using the LispWorks system construction tools you can try
"M-x System Search" or "M-x System Query Replace" depending on what
you'd really like to do.  There are other search and replace commands
for searching (and replacing) across directories, through tags files,
multiple buffers, or just the current editor buffer.  You can suspend
these types of searches by performing random edits and "M-," will
resume the search.

> If this matters, I'm using LispWorks. There is something which helps
> in restricted range of errors - you can select a function and see all
> places where it gets called from.

The LispWorks function call browser allows you to visualize (among
other things) recorded "who calls" information and jump to the source
definitions of interesting functions.
From: Lennart Staflin
Subject: Re: Refactoring in Lisp
Date: 
Message-ID: <m2n0qemlr1.fsf@lysator.liu.se>
I can't help the OP. But I have been reading /Refactoring: Improving
the Design of Existing Code/ by Martin Fowler and I have been
thinking about refactoring and Lisp. There is at least two aspects:

- The Lisp language and refactoring: is there something in Lisp that
helps (or hinders) refactoring.

- Our Tools: The Interlisp TTY edtior had refactoring support :)  It
could extract functions (MAKEFN) or inline them (GETD). There where
also commands to manipulated conditionals.

Side note: have you seen any Emacs (or FRED) code to convert between
IF and COND. That would be nice. (It is a small itch -- I haven't got
around to writing it myself.)

//Lennart