From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Florian Kaufmann" Newsgroups: gmane.emacs.help Subject: Re: multiple search strings in query-replace-regexp Date: 6 Oct 2006 07:14:38 -0700 Organization: http://groups.google.com Message-ID: <1160144078.397926.234980@k70g2000cwa.googlegroups.com> References: <1160133442.016714.5230@m7g2000cwm.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1160145715 2135 80.91.229.2 (6 Oct 2006 14:41:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 6 Oct 2006 14:41:55 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 06 16:41:53 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 1GVqsE-0004UV-Aa for geh-help-gnu-emacs@m.gmane.org; Fri, 06 Oct 2006 16:40:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GVqsD-0008Q5-Qs for geh-help-gnu-emacs@m.gmane.org; Fri, 06 Oct 2006 10:40:25 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!k70g2000cwa.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 24 Original-NNTP-Posting-Host: 194.209.139.160 Original-X-Trace: posting.google.com 1160144082 9815 127.0.0.1 (6 Oct 2006 14:14:42 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 6 Oct 2006 14:14:42 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: k70g2000cwa.googlegroups.com; posting-host=194.209.139.160; posting-account=Z44m8A0AAADexMuhVGiPev7CXD9-sJX0 Original-Xref: shelby.stanford.edu gnu.emacs.help:142224 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:37843 Archived-At: > Write a little function in *scratch* buffer with n replace-regexp, > then load and apply it! Yes, that's true. But I have to be careful that I take the nearest match. Something like saved_point = point next_match_pos = INFINIT for all regexes in regexlist { match_pos = search( current regex ) if ( match_pos < next_match_pos ) { next_match_pos = match_pos regex_to_apply = current regex } goto saved_point } searc_replace( regex_to_apply ) Mhh, no, that doesn't work either. Now how should I implement the thing that I can press all that query-replace keys like y n . etc? Of course pressing y should advance to the nearest next match of any of the regex from the regexlist.