From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Peter Dyballa Newsgroups: gmane.emacs.help Subject: Re: replace regex takes long Date: Sun, 16 Apr 2006 12:17:26 +0200 Message-ID: <1F82E20F-F5E5-47BD-8CB5-D30EC99C2B1A@Web.DE> References: <87zmimbk9n.fsf@localhost.localdomain> <873bgexwq4.fsf@localhost.localdomain> <87fykepg4b.fsf@localhost.localdomain> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1145182672 5274 80.91.229.2 (16 Apr 2006 10:17:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 16 Apr 2006 10:17:52 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 16 12:17:50 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 1FV4KC-00060R-98 for geh-help-gnu-emacs@m.gmane.org; Sun, 16 Apr 2006 12:17:48 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FV4KB-0002tI-E5 for geh-help-gnu-emacs@m.gmane.org; Sun, 16 Apr 2006 06:17:47 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FV4Jz-0002s5-I7 for help-gnu-emacs@gnu.org; Sun, 16 Apr 2006 06:17:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FV4Jx-0002rQ-Oe for help-gnu-emacs@gnu.org; Sun, 16 Apr 2006 06:17:35 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FV4Jx-0002rF-Hz for help-gnu-emacs@gnu.org; Sun, 16 Apr 2006 06:17:33 -0400 Original-Received: from [217.72.192.227] (helo=fmmailgate02.web.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FV4KM-0002Ci-6P for help-gnu-emacs@gnu.org; Sun, 16 Apr 2006 06:17:58 -0400 Original-Received: by fmmailgate02.web.de (8.12.10/8.12.10/webde Linux 0.7) with ESMTP id k3GAHUb9025651; Sun, 16 Apr 2006 12:17:30 +0200 Original-Received: from [84.245.175.181] (helo=[192.168.1.2]) by smtp08.web.de with asmtp (TLSv1:RC4-SHA:128) (WEB.DE 4.106 #94) id 1FV4Ju-0000Hw-00; Sun, 16 Apr 2006 12:17:30 +0200 In-Reply-To: <87fykepg4b.fsf@localhost.localdomain> X-Image-Url: http://homepage.mac.com/sparifankal/.cv/thumbs/me.thumbnail Original-To: Gary Wessle X-Mailer: Apple Mail (2.749.3) X-Sender: Peter_Dyballa@web.de 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:34396 Archived-At: Am 16.04.2006 um 01:35 schrieb Gary Wessle: > 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. When the message appears in the mini-buffer the task is completed. Could be your operating system is recovering from the task. 4 MB of data are a lot, 304,172 replacements (four in every line) are "buffered" for undo's *and* 304,172 times marks where set in the buffer *and* areas highlighted and in the end de-highlighted. GNU Emacs itself is clearing its programme stack to be prepared for the next command. replace.el explains: This function is usually the wrong thing to use in a Lisp program. What you probably want is a loop like this: (while (re-search-forward REGEXP nil t) (replace-match TO-STRING nil nil)) which will run faster and will not set the mark or print anything." -- Greetings Pete === -Q ==<__/% >> _____________(_)____@_____________________________