all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: <help-gnu-emacs@gnu.org>
Cc: asd@cdotb.ernet.in
Subject: RE: How not to list the .o files in find-dired
Date: Tue, 17 Mar 2009 10:12:10 -0700	[thread overview]
Message-ID: <006801c9a723$83d973d0$0200a8c0@us.oracle.com> (raw)
In-Reply-To: <87ljr45dtx.fsf@tux.homenetwork>

> > The find-dired lists all the files recursively under a directory.
> > But i don't want to list the .o files and backup files.
> > How to do that?

`find-dired' is a wrapper for the UNIX-GNU/Linux `find' command. `find' lets you
specify the filenames to match. You should be able to specify something like
`-name *.[^o~]' as the file-name pattern to match (you might need a more complex
pattern).

I've forgotten what I knew in a former life about `find' (which is a language
unto itself!), but perhaps someone else can give you a precise incantation.

Someone else also mentioned Dired X. It lets you omit files with certain
extensions. But that does not affect what `find' sees; it affects only what
Dired sees. It can perhaps be useful once `find-dired' has gathered files into a
Dired buffer (to let you omit some of them), but I don't think it will help
prevent `find-dired' from finding certain files.

> traverselisp.el do that and you can setup a list of files to ignore in
> `traverse-ignore-files'. You can put a plain name of file, a regexp
> matching file-name, or an extension of file in this list.
> You can match also only certain types of files or ext files.
> Traverselisp have also an anything extension that list files 
> recursively in current-dir (with same options).
> See in emacswiki: traverselisp.el anything-traverse.el Anything

You can also use Icicles to do what you want. Use `icicle-locate-file'. Type the
file-name pattern you want to match (you can use a regexp). You can match any
parts of the file names, including directory components.

To then eliminate .o and backup files from the matching files, hit `M-SPC' to
also match another pattern. For the second pattern, type `\.o$' (to get just the
.o files), then hit `C-~' to remove those (the .o files) from the list of
candidates. Similarly, to eliminate backup files from the list (the backup
pattern you use depends on your backup naming convention).

You can use `M-SPC' for any number of patterns to match the files you need - use
`C-~' to match negatively. Think of `M-SPC' as set interesection and `C-~' as
set complement.

This gives you a complete list of all files under some directory that match your
input pattern, except for the .o and backup files. The names in this list are
candidates for completion. You can act on one or more of them immediately (using
`RET' or `C-RET'), to open it, or you can save the list for later use
(persistently, if you like).

You can also open Dired on the files in the list. That will give you just what
you asked for: Dired for all and only the files you want under some directory,
regardless of which subdirectories they are from. And, if you saved the list
persistently (see above), then you can later reopen Dired on just those files in
any subsequent Emacs session.

See:
http://www.emacswiki.org/emacs/Icicles_-_File-Name_Input
http://www.emacswiki.org/emacs/Icicles_-_Persistent_Completions
http://www.emacswiki.org/emacs/Icicles_-_Dired_Enhancements
http://www.emacswiki.org/emacs/Icicles_-_Support_for_Projects






  reply	other threads:[~2009-03-17 17:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-17 14:06 How not to list the .o files in find-dired Anand Dhanakshirur
2009-03-17 15:48 ` Peter Dyballa
2009-03-17 16:11 ` thierry.volpiatto
2009-03-17 17:12   ` Drew Adams [this message]
2009-03-17 18:08     ` Peter Dyballa
2009-03-17 18:25     ` Peter Dyballa
2009-03-18  9:18       ` Peter Dyballa
2009-03-18  9:31         ` Anand Dhanakshirur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='006801c9a723$83d973d0$0200a8c0@us.oracle.com' \
    --to=drew.adams@oracle.com \
    --cc=asd@cdotb.ernet.in \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.