Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!STARBASE.MITRE.ORG!israel From: israel@STARBASE.MITRE.ORG (Bruce Israel) Newsgroups: gnu.emacs.bug Subject: Re: replace-regexp Message-ID: <8904130343.AA05725@starbase> Date: 13 Apr 89 03:43:37 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 25 From: mailrus!sharkey!itivax!umich!zip!spencer@purdue.edu (Spencer W. Thomas) In some article loic%axis_d@axis.axis.fr writes: > (replace-regexp "^." "" ()) > It empties my buffer ! > It should skip to the next new-line. Don't you think so ? Well, no. Emacs is a character-oriented editor, NOT a line-oriented editor. Would you want it to skip to the next line after each replacement if the strings were (say) "abc" and ""? No, it shouldn't skip to the next line, but it SHOULD skip past the previously matched string. i.e. replacing "foo bar" with "foo" should not change "foo bar bar " to "foo", it should become "foo bar". A replacement should not be re-run on the results of the replacement. Effectively, a replace- should look like it found all non-overlapping occurences of the search item first, and then did the change second. For a similar example, should the null op (replace-string "a" "a") be an infinite loop? I think that the workarounds given for this problem are excessively complicated for the task the guy is trying to perform. Bruce