Re: It seems like a good idea
No, the fundamental problem is that the bloody editor wants to run arbitrary bits of code when you didn't ask it to.
Fix that entirely unnecessary misfeature by deleting it and you don't have to run rings around yourself trying to stop it in all the cases where that's a bad idea.