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

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

Re: creating a tags file for interactive search and replace regexp


From: Ryan Krauss
Subject: Re: creating a tags file for interactive search and replace regexp
Date: Mon, 19 Jun 2006 22:21:17 -0400

Thanks Eric, this seems like a good start.

It seems like your shell script is just passing a list of file names
or paths to etags.  Is that true?  If I already have a python script
that finds only the files I want, can I just use python to call etags
file1.tex file2.tex ...    ?

Is there a way to do the dired-do-query-replace-regexp based on marked
files in the standard buffer list?  The reason I ask is that it is
very easy for me to use python to open emacs with only the files I
want (basically doing emacs file1.tex file2.tex ...).  The buffer list
will already have all the files I want and only the files I want.

Basically, I have a directory tree with my thesis in it.  I want to
search and replace the Latex files I actually use in the thesis.  But
the tree is a mess with many files I don't think I use but don't dare
delete yet and many subfolders.  So, there are .tex files everywhere.
I have written a python script that parses the main Latex file looking
for \input lines and based on the \input files (and the files they
input), python gives me a list of the *.tex files actually used.
There are 40 "good" *.tex files and over 1300 total *.tex files in the
tree.  So, I really need to do something with the list of
filenames/paths coming out of Python - i.e I need to pass the list to
something, generate my own etags file, or work on the emacs buffer
list.

I know I have made this mess myself, but can someone show me a good
way out of it?

Thanks,

Ryan

On 6/19/06, Eric Hanchrow <offby1@blarg.net> wrote:
>>>>> "Ryan" == Ryan Krauss <ryanlists@gmail.com> writes:

    Ryan> I want to do an interactive regexp search and replace on a
    Ryan> list of files.  I don't want to search all the files in one
    Ryan> directory and the files are actually in many different
    Ryan> directories.  How do I do this search and replace on a
    Ryan> specified list?  I think I need a list of tag files.  But I
    Ryan> cannot find an example of the syntax of such a tag file.

Sometimes I make a TAGS file, and then do tags-query-replace.  Read
the man page for etags; it's pretty flexible.  Here's an example of a
shell script that creates a TAGS file for certain files only:

find .                                          \
    \(                                          \
      -type d                                   \
         \(  -iname boring -prune \)      \
      -o \(  -iname also-boring -prune \)               \
    \)                                          \
    -o                                          \
    \(                                          \
    -type f                                     \
    \(                                          \
    -name '*.pas'                               \
    -o -name '*.dfm'                            \
    -o -name '*.p[lm]'                          \
    -o -name '*.js'                             \
    -o -name '*.sql'                            \
    \) -print                                   \
    \) | etags -

You can also do "find-dired", then mark any or all of the resulting
files, then type Q (dired-do-query-replace-regexp).

--
One of the fundamental philosophical questions of our time is
why Goofy is a person and Pluto is a dog.
        -- Roger Ebert



_______________________________________________
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]