Programmatic editing of source files

Hello,

I noticed that as I evolve code I often must make rather fundamental changes, such as adding a argument to a predicate used across many locations and modules.

Is there an convenient way to do such changes programmatically – e.g. search for all predicates p1, add arg4 as last argument.

Dan