Use more idiomatic code for Emacs string-replacement.