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: Andreas Röhler
Subject: Re: Interative batch query-replace question
Date: Sat, 1 Dec 2007 18:39:03 +0100
User-agent: KMail/1.9.5

Am Samstag, 1. Dezember 2007 10:11 schrieb Ke Lu:
> Perhaps my explain is not quite enough.
>
> I want to query-replace some files.(not filename)
...


So we have basically two tasks

1 - find the list of files
2 - operate on them

Dired probably isn't TRT here, because it's for
manually operation.

Maybe run this at your dir to have some impression how
it may start:

(defun my-list-of-files ()
  " "
  (interactive)
  (let ((my-endings-list '(".co$" ".java$")))
    (dolist (el my-endings-list)
      (let ((files (directory-files default-directory t el)))
        (while files
          (let ((file (car files)))
            (when (file-exists-p file)
              (when (y-or-n-p (concat "You agree to change \""file"\" later")))
              (message "Later we will change name and contents of %s " file))
            (setq files (cdr files))))))))


Andreas Röhler




reply via email to

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