From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Gary Wessle Newsgroups: gmane.emacs.help Subject: Re: replace regex takes long Date: 16 Apr 2006 21:53:06 +1000 Organization: iPrimus Customer - reports relating to abuse should be sent to abuse@iprimus.com.au Message-ID: <874q0tbuu5.fsf@localhost.localdomain> References: <87zmimbk9n.fsf@localhost.localdomain> <873bgexwq4.fsf@localhost.localdomain> <87fykepg4b.fsf@localhost.localdomain> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1145191225 24200 80.91.229.2 (16 Apr 2006 12:40:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 16 Apr 2006 12:40:25 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 16 14:40:24 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FV6Y8-0006d5-Iy for geh-help-gnu-emacs@m.gmane.org; Sun, 16 Apr 2006 14:40:21 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FV6Y7-0006Mw-PC for geh-help-gnu-emacs@m.gmane.org; Sun, 16 Apr 2006 08:40:19 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!newsfeed.pacific.net.au!token.pipenetworks.com!218.100.2.59.MISMATCH!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 X-Original-NNTP-Posting-Host: 58.178.42.196 X-Original-NNTP-Posting-Host: 127.0.0.1 Original-Lines: 54 Original-NNTP-Posting-Host: 203.134.67.67 Original-X-Trace: 1145188370 un-2park-reader-01.sydney.pipenetworks.com.au 10140 203.134.67.67:1401 Original-X-Complaints-To: Abuse, including message IDs to abuse@pipenetworks.com Original-Xref: shelby.stanford.edu gnu.emacs.help:138779 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:34397 Archived-At: Eli Zaretskii writes: > > From: Gary Wessle > > Date: 16 Apr 2006 09:35:00 +1000 > > > > Gary Wessle writes: > > > > > Peter Dyballa writes: > > > > > > > Am 15.04.2006 um 23:29 schrieb Gary Wessle: > > > > > > > > > M-x query-replace-regex + > > > > > the file size is 4162111 with 77000 lines on PentiumIII 500, it has > > > > > been 10 minutes so I opened another emacs processor to write and > > > > > post this. > > > > > is there a problem with my command and why it is taking that long? > > > > > > > > Yes, because the command needs your co-operation. And if you don't > > > > press "yes" no change will be made. > > > > > > if fact I forget to say that I did hit ! which means "replace all" > > with M-x regex-replace it shows (replaced 304172 occurrences) and it > > is taking more than 5 minutes now and still have not finished the > > task. > > I just tried query-replace-regex on a file with the structure you > described, and the command ran to completion in just 40 seconds, > including 3 questions whether to discard undo info. That was on a > 3-GHz Pentium 4 in a buffer that is in Fundamental mode. So your > timing seems very unusual, to say the least. > > Do you have some specialized major mode in that buffer? If so, > perhaps it slows down the replacement; try in Fundamental mode. I'd > also suggest to try the command in "emacs -q", perhaps something in > your customizations slows down the replacements. > > In any case, your command is wasteful because it forces Emacs to > replace even a single space. I suggest to try this instead: > > M-x query-replace-regex + > ^^ > two spaces here > > This command takes just 20 seconds on my machine. > > Btw, what version of Emacs do you have, and on which OS? I did it as you described, #emacs -q M-x query-replace-regex + it took 24 sec. my OS is debian testing and emacs version 21.4.1 thanks