🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #1573

Re: replace-regexp

#1573
From: Spencer W. Thomas
Date: Wed, 12 Apr 1989 00:48
20 lines
1199 bytes
In article <8904102352.AA22601@inria.inria.fr> 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 ""?  How should it
distinguish the two cases?  To get the effect (that I presume) you
want, you can say
	(replace-regexp "^.\\(.?\\)" "\\1")
or	(replace-regexp "^.\\(.*\\)" "\\1")

I think the first will be a little more efficient.

--
=Spencer (spencer@eecs.umich.edu)
Technical Details
Message-ID: <SPENCER.89Apr11204842@spline.eecs.umich.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!sharkey!itivax!umich!zip!spencer
References: <8904102352.AA22601@inria.inria.fr>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!sharkey!itivax!umich!zip!spencer
From: spencer@eecs.umich.edu (Spencer W. Thomas)
Newsgroups: gnu.emacs.bug
Subject: Re: replace-regexp
Message-ID: <SPENCER.89Apr11204842@spline.eecs.umich.edu>
Date: 12 Apr 89 00:48:42 GMT
References: <8904102352.AA22601@inria.inria.fr>
Sender: news@zippy.eecs.umich.edu
Distribution: gnu
Organization: University of Michigan EECS Dept
Lines: 20
In-reply-to: loic%axis_d@axis.axis.fr's message of 10 Apr 89 23:52:42 GMT