Matthew -
Well, I believe there is an outfit called Wooden Chair Software who sells
tools to do this sort of thing. Also, here is an emacs function to map
another emacs function (eg. (lambda () (replace-string "foo" "bar")))
throughout a whole directory tree. We have a number of higher-level
functions that "clean up" our code that are written on top of kt-map-tree;
we don't generally call it interactively. We'll get it cleaned up and
packaged to submit to the JDE contributions library Real Soon.
-------------------------------------------
;;; kt-map-tree function directory regexp
;;; For each file in the tree rooted at directory, whose name is matched
;;; by regexp, open a buffer on the file, apply function in the buffer,
;;; then save the file. The buffers are left open in the emacs env.
(defun kt-map-tree (function directory regexp)
"Applies function to each of the files whose names match regexp in the
tree rooted at directory. Function must take no arguments, and must
apply to a whole buffer. For example, if you wanted to process HTML files,
you could use \"[A-Za-z0-9]*.html?$\" for the regexp"
(interactive "aFunction:
DDirectory:
sRegexp: ")
(if (string-match regexp directory)
;; it's one of the files we are interested in...
(kt-process-file function directory)
(mapc '(lambda (dir)
(kt-map-tree function dir regexp))
(directory-files directory t "[a-zA-Z]"))))
;;; usage: java-process-file function filename
;;; - If directory is a .java file, then it is opened, the function is
;;; applied to its buffer, and it is saved and closed.
(defun kt-process-file (function filename)
"Applies function to the file named by filename, by opening a buffer,
running function in the buffer, and saving the buffer back to the file."
(find-file filename)
(if buffer-read-only
(progn
(toggle-read-only)
(funcall function)
(print (format "***Read-only file %s: not saved" filename)))
(progn
(funcall function)
(save-buffer))))
-------------------------------------------------
Cheers -
John Collins
KeyTech LLC, St. Paul, MN.
> -----Original Message-----
> From: Matthew Weymar [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 01, 1999 4:21 PM
> To: [EMAIL PROTECTED]
> Subject: Help / Suggestions re Updating Code
>
>
> This is not necessarily strictly a JDE question, but it's got
> a JDE slant, so
> here goes:
>
> I am a novice programmer faced w/ the need to update a
> project w/ various
> classes in various directories (packages?).
>
> My basic question is: Is there a way, using the JDE (or not),
> to change variable
> names project-wide?... Or is there some convenient way to
> find all of the
> references in a project to a particular variable - short of
> going through one's
> classes one-by-one, and searching-and-replacing?... which
> isn't, of course, the
> end of the world, but if there's some better way, I'd sure
> like to know about
> it.
>
> Tks,
> Matthew Weymar
>
>