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: Ke Lu
Subject: Re: Interative batch query-replace question
Date: Fri, 30 Nov 2007 10:58:51 +0900
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

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 <andreas.roehler@online.de> 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 <lu@luxdo.jp> writes:
>> > Yes,Only the first one is executed.
>> >
>> > Andreas Röhler <andreas.roehler@online.de> 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 <lu@luxdo.jp> 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


reply via email to

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