help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interative batch query-replace question


From: Xah Lee
Subject: Re: Interative batch query-replace question
Date: Sat, 1 Dec 2007 07:19:29 -0800 (PST)
User-agent: G2/1.0

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
  address@hidden
\xAD\xF4 http://xahlee.org/

On Dec 1, 1:11 am, Ke Lu <address@hidden> 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月 21  2003 ejbdemo/DemoEntity.java
  -rw-r--r--  1 lu lu 178  1月 21  2003 ejbdemo/DemoSession.java
  -rw-r--r--  1 lu lu 146  1月 21  2003 ejbdemo/DemoSessionLocal.java
  -rw-r--r--  1 lu lu 573  1月 21  2003 ejbdemo/DemoSessionEJB.java
  -rw-r--r--  1 lu lu 194  1月 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月 21  2003 ejbdemo/DemoEntity.java
* -rw-r--r--  1 lu lu 178  1月 21  2003 ejbdemo/DemoSession.java
* -rw-r--r--  1 lu lu 146  1月 21  2003 ejbdemo/DemoSessionLocal.java
* -rw-r--r--  1 lu lu 573  1月 21  2003 ejbdemo/DemoSessionEJB.java
  -rw-r--r--  1 lu lu 194  1月 21  2003 ejbdemo/DemoSessionHome.java
* -rw-r--r--  1 lu lu 159  1月 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?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]