Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^2: Refactoring copy-pasted code

by jvector (Friar)
on May 07, 2009 at 16:46 UTC ( #762662=note: print w/replies, xml ) Need Help??

in reply to Re: Refactoring copy-pasted code
in thread Refactoring copy-pasted code

I have found the 'ediff' code-merging tools within Emacs useful for situations that are kind of like yours. There is an 'ediff-buffers' command that splits the screen highlighting the detected differences between the code in two edit buffers, and allows you to step through the list of differences. Single keystrokes 'a','b' will put what is in buffer A into the corresponding difference in buffer B, and vice versa. There are many other things you can do in this mode as well. Emacs also provides 'ediff-buffers3' which does 3 files at once, and 'ediff-directories' which sets up a 'session' going through all the files in a pair of directories. I might feel inclined to load up scripts A and B, copy one of them to a new file AB, and manually construct AB to be an abstracted union of the two. You could then do the same with script C, then D...

Hey!! Wait! This isn't my signature!!

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://762662]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2023-06-05 20:06 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (25 votes). Check out past polls.