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

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

Re: Finding files with tags


From: Kevin Rodgers
Subject: Re: Finding files with tags
Date: Mon, 13 Mar 2006 11:56:06 -0700
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

mlathe wrote:
Is it possible get a listing of all the filenames that match a grep on TAGS?
Ideally you wouldn't need to cycle through the list but rather you would
simply get a listing in a buffer similar to dired or grep-find (no sure
about the exact term) that actually open the buffer.

Currently i use an index that i created using find, and some various tools i
wrote to do greps on that list. However i need to do this in the emacs
shell, then copy it into the find-file. Its not exactly ideal.

Here's what I came up with (note the literal DEL character immediately
after the first comma in the sed regex):

(defun dired-tags-table (tags)
  "Use Dired mode to edit the files listed in the TAGS table."
  ;; (interactive ...) copied from visit-tags-table:
  (interactive (list (read-file-name "Dired tags table: (default TAGS) "
                                     default-directory
                                     (expand-file-name "TAGS"
                                                       default-directory)
                                     t)))
  (dired (cons (file-name-directory tags)
               (split-string
                (shell-command-to-string
                 (format "sed -n 's/^\\([^,]*\\),[1-9][0-9]*$/\\1/p' %s"
                         tags))))))


--
Kevin Rodgers





reply via email to

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