From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ke Lu Newsgroups: gmane.emacs.help Subject: Re: Interative batch query-replace question Date: Fri, 30 Nov 2007 10:58:51 +0900 Organization: Bentium Ltd. (CN99) Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1196390443 30662 80.91.229.12 (30 Nov 2007 02:40:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 30 Nov 2007 02:40:43 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 30 03:40:50 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 1Ixvo9-0007f0-MJ for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Nov 2007 03:40:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ixvnu-0000Sd-0E for geh-help-gnu-emacs@m.gmane.org; Thu, 29 Nov 2007 21:40:34 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!news.cn99.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 82 Original-NNTP-Posting-Host: softbank218118058050.bbtec.net Original-X-Trace: news.cn99.com 1196392274 16913 218.118.58.50 (30 Nov 2007 03:11:14 GMT) Original-X-Complaints-To: usenet@news.cn99.com Original-NNTP-Posting-Date: Fri, 30 Nov 2007 03:11:14 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) Cancel-Lock: sha1:yLF3UB0VYbou+rAAbhfqO/4kvcM= Original-Xref: shelby.stanford.edu gnu.emacs.help:154280 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:49709 Archived-At: My task is: 1. Use find-dired to Find all java file in a fold. 2. Mark all file in "*Find*" buffer 3. call batch-query-replace-regexp. (I must do it, because I have about 50 pattern to query-replace-regexp and I must do it in interative way to confirm if it is right) >> (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 >> ) >> Andreas Röhler writes: > If you could give a short description of your task, > that may help to find the code. > > AFAIK `dired-' is designed to be called from the > dired-buffer. If you do query-replace from a program, > you probably should use other functions. > > > Andreas Röhler > >> The problem is: >> (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") >> ) >> >> Ke Lu writes: >> > Yes,Only the first one is executed. >> > >> > Andreas Röhler writes: >> >> Am Donnerstag, 29. November 2007 06:56 schrieb Ke Lu: >> >>> Sorry, I forgot to move point to the begining of buffer, >> >>> It is ok now. >> >>> >> >>> But dired-do-query-replace-regexp still have some peoblem. >> >>> My function looks like: >> >>> (defadvice query-replace-regexp (before >> >>> move-start-after-query-replace-regexp activate) >> >>> (goto-char (point-min))) >> >>> >> >>> (defun batch-query-replace-regexp() >> >>> (interactive) >> >>> (switch-to-buffer "*Find*") >> >>> (dired-do-query-replace-regexp "jp\\.co" "jp.co2") >> >>> (switch-to-buffer "*Find*") >> >>> (dired-do-query-replace-regexp "java" "java2") >> >>> ) >> >>> >> >>> But the second one can't be executed and there is not any >> >>> error message. >> >>> What is the reason? >> >>> >> >>> Ke Lu writes: >> >>> > I want to do a Interative batch query-replace which looks like: >> >>> > (defun a-batch-query-relace() >> >>> > (interactive) >> >>> > (query-replace "jp.co" "jp.co2") >> >>> > (query-replace "java" "java2") >> >>> > ..... >> >>> > ) >> >>> > But only first query-replace be excuted,I would like to know why >> >>> > and how to solve it. >> >>> >> >>> _______________________________________________ >> >> >> >> Same problem? >> >> _______________________________________________ >> help-gnu-emacs mailing list >> help-gnu-emacs@gnu.org >> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs