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 18:25:03 +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 1196415816 23172 80.91.229.12 (30 Nov 2007 09:43:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 30 Nov 2007 09:43:36 +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 10:43:45 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 1Iy2PO-0003Rg-4R for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Nov 2007 10:43:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iy2P7-0002bz-NQ for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Nov 2007 04:43:25 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!goblin1!goblin.stu.neva.ru!goblin2!goblin2.stu.neva.ru!news.bbh.net.cn!news.neu.edu.cn!news.cn99.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 54 Original-NNTP-Posting-Host: softbank218118058050.bbtec.net Original-X-Trace: news.cn99.com 1196419050 2194 218.118.58.50 (30 Nov 2007 10:37:30 GMT) Original-X-Complaints-To: usenet@news.cn99.com Original-NNTP-Posting-Date: Fri, 30 Nov 2007 10:37:30 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) Cancel-Lock: sha1:2G5ll/+yskgSzFRdFlB+4DIT4kE= Original-Xref: shelby.stanford.edu gnu.emacs.help:154289 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:49719 Archived-At: I want do it only once. I just want to call dired-do-query-replace-regexp many times in a function. The thing is the only the first call is excuted, Don't you feel Is it strange? Or it is the bug of dired? Andreas Röhler writes: > Am Freitag, 30. November 2007 02:58 schrieb Ke Lu: >> jp\\.co > > To question is: Must you do that just once and only > renaming is at stake? If yes, I'd choose `wdired'. > > Should you have the same renamings to perform > repeatedly and/or other tasks than renaming with this > files--backups, contents changes or whatever--I would > write a skript aside from dired. > > BTW the *Find*" buffer usually is > write-protected. Editing them looks special for me. > > To get the appropriate files in directory I'd choose > something like > > (let ((files (directory-files (expand-file-name (substitute-in-file-name dir)) > t "jp\\.co$"))) > (while files > (let ((file (car files))) > (when (file-exists-p file) > > DO SOMETHING > (setq files (cdr files)))))) > > ;;;;;;; > > For DO SOMETHING > > you could proceed > > (if (string-match ... > > ;; your interactive form > (y-or-n-p > (rename-file ... > > DO MORE THINGS > > ;;;;;;;;;;; > > HTH > > Andreas Röhler