From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: query-replace-interactive not documented Date: 18 Jun 2004 09:13:05 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <20040528.181649.25475113.wl@gnu.org> <87659snbd8.fsf@mail.jurta.org> <87llin98sc.fsf@mail.jurta.org> <87n033y0yj.fsf@mail.jurta.org> <87fz8u19ou.fsf@mail.jurta.org> <87u0x92xpq.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1087542829 29803 80.91.224.253 (18 Jun 2004 07:13:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 18 Jun 2004 07:13:49 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Jun 18 09:13:41 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BbDZF-0004Jd-00 for ; Fri, 18 Jun 2004 09:13:41 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BbDZF-0002OA-00 for ; Fri, 18 Jun 2004 09:13:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BbDaK-00006d-Lx for emacs-devel@quimby.gnus.org; Fri, 18 Jun 2004 03:14:48 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BbDa9-00006I-TH for emacs-devel@gnu.org; Fri, 18 Jun 2004 03:14:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BbDa9-00005y-2u for emacs-devel@gnu.org; Fri, 18 Jun 2004 03:14:37 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BbDa8-00005h-WB for emacs-devel@gnu.org; Fri, 18 Jun 2004 03:14:37 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BbDYg-0007vg-Nh for emacs-devel@gnu.org; Fri, 18 Jun 2004 03:13:06 -0400 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1BbDYg-0000HQ-1v; Fri, 18 Jun 2004 03:13:06 -0400 Original-To: Juri Linkov In-Reply-To: <87u0x92xpq.fsf@mail.jurta.org> Original-Lines: 36 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:25074 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25074 Juri Linkov writes: > David Kastrup writes: > > Here is a sketch. I am calling it a sketch since the string-match for > > \? should not be done for every replacement again if the replacement > > string did not contain \? in the first place. This is a performance > > hog otherwise when doing lots of replacements automatically. > > You can match it once in the beginning of the main while-loop and > store the result into a variable which would be given as an argument > of `replace-match-maybe-edit'. Which is more or less what I do now in the current code. However, I am still trying to get a hang on the match-data: it needs to be in markers when editing functions are called since the user might then change buffers end edit stuff behind the back of the program. Quite ugly. I am trying to get this both correct and efficient at the same time. Strictly speaking, one needs markers for every non-made change in the stack when user-editing is allowed. Perhaps one should allow only a certain number of unmade replacements and kill off all markers further back in the history. > But generally your changes work fine. I only want to propose some > improvements: when the user types ! to replace all matches and the > replacement string contains \?, then matches are not highlighted in > the buffer when the user edits the replacement. This could be > highlighted before reading the replacement string in > `replace-match-maybe-edit' by calling `replace-highlight'. I am still trying to get the code to do the right think which it doesn't. Of course, not just the fault of \? here. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum