Make projectile-replace work with lexical binding

The previous version actually only worked because of dynamic binding and broke when projectile switched.  This should fix it (and it seems cleaner anyway).