eggert@twinsun.com (Paul Eggert) (10/21/89)
If the first argument to replace-regexp matches the empty string, replace-regexp should insert the second argument everywhere from point through the buffer end. It doesn't perform the last insertion. Here's an example. % emacs -q M-x emacs-version RET [ Echoes "GNU Emacs 18.55.0 on farside (berkeley-unix)" in the command line. ] [ We now have an empty *scratch* buffer.] M-x re-search-forward RET a* RET [This silently succeeeds, because it finds the empty string, which is an instance of a*.] M-x replace-regexp RET a* RET b RET [This says "Done", but it didn't replace the empty string that it found.] Another example: when (replace-regexp "a*" "b") is executed at the start of a nonempty buffer, GNU Emacs inserts a "b" between each character, and at the start of the buffer, but it forgets to insert a "b" at the end of the buffer.