From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: Interative batch query-replace question Date: Sat, 1 Dec 2007 07:19:29 -0800 (PST) Organization: http://groups.google.com Message-ID: <65e12572-4a77-4f05-ac7a-3e0135279cd2@e25g2000prg.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1196523645 404 80.91.229.12 (1 Dec 2007 15:40:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Dec 2007 15:40:45 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Dec 01 16:40:53 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IyUSY-0008GW-AD for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Dec 2007 16:40:50 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IyUSI-0007cK-CH for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Dec 2007 10:40:34 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!e25g2000prg.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 65 Original-NNTP-Posting-Host: 69.236.127.3 Original-X-Trace: posting.google.com 1196522369 18708 127.0.0.1 (1 Dec 2007 15:19:29 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 1 Dec 2007 15:19:29 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: e25g2000prg.googlegroups.com; posting-host=69.236.127.3; posting-account=qPxGtQkAAADb6PWdLGiWVucht1ZDR6fn User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/523.12 (KHTML, like Gecko) Version/3.0.4 Safari/523.12, gzip(gfe), gzip(gfe) Content-Disposition: inline Original-Xref: shelby.stanford.edu gnu.emacs.help:154330 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:49759 Archived-At: Hi Ke Lu, what you want to do is exactly what i wanted to do ever since i knew about dired-do-query-replace-regexp. In summary, you want to use it to do multiple find-replace pairs. (Note: i have (defalias 'ddqrr 'dired-do-query-replace-regexp) ) I don't think you can just slap in several ddqrr in your own function to achieve multiple find-replace pairs one-shot. Rather, i think you need to find the function that's behind the interface used by ddqrr. Xah xah@xahlee.org $B-t(B http://xahlee.org/ On Dec 1, 1:11 am, Ke Lu wrote: Perhaps my explain is not quite enough. I want to query-replace some files.(not filename) 1. Use find-dired to Find some files.(M-x find-dired) In "*File" buffer,it looks like: /home/lu/workspace/: find . \( -name "*.java" \) -exec ls -ld \{\} \; -rw-r--r-- 1 lu lu 215 1$B7n(B 21 2003 ejbdemo/DemoEntity.java -rw-r--r-- 1 lu lu 178 1$B7n(B 21 2003 ejbdemo/DemoSession.java -rw-r--r-- 1 lu lu 146 1$B7n(B 21 2003 ejbdemo/DemoSessionLocal.java -rw-r--r-- 1 lu lu 573 1$B7n(B 21 2003 ejbdemo/DemoSessionEJB.java -rw-r--r-- 1 lu lu 194 1$B7n(B 21 2003 ejbdemo/DemoSessionHome.java 2. Mark some file in "*Find*" buffer In "*File" buffer,it looks like: /home/lu/workspace/: find . \( -name "*.java" \) -exec ls -ld \{\} \; -rw-r--r-- 1 lu lu 215 1$B7n(B 21 2003 ejbdemo/DemoEntity.java * -rw-r--r-- 1 lu lu 178 1$B7n(B 21 2003 ejbdemo/DemoSession.java * -rw-r--r-- 1 lu lu 146 1$B7n(B 21 2003 ejbdemo/DemoSessionLocal.java * -rw-r--r-- 1 lu lu 573 1$B7n(B 21 2003 ejbdemo/DemoSessionEJB.java -rw-r--r-- 1 lu lu 194 1$B7n(B 21 2003 ejbdemo/DemoSessionHome.java * -rw-r--r-- 1 lu lu 159 1$B7n(B 21 2003 ejbdemo/ DemoSessionLocalHome.java 3. call batch-query-replace-regexp. >> (defun batch-query-replace-regexp() >> (interactive) >> (switch-to-buffer "*Find*") >> (dired-do-query-replace-regexp "jp\\.co" "jp.co2") >> ->can't reach here (switch-to-buffer "*Find*") >> (dired-do-query-replace-regexp "java" "java2") ...a lot of pattern to query-replace-regexp>> ) You can press "Q" key to dired-do-query-replace-regexp once. But I have about 50 patterns to replace, do it one by one is quite troublesome. so I copy patterns from excel file and write them to a function (which named batch-query-replace-regexp above). The problem is the function finished when first call of dired-do-query-replace-regexp finish. Doesn't you feel it is strange?