Nice idea, but I think it'd be better to use sudo-edit as a backend engine, because it has more checks and covers many more cases of filenames.