[Top][All Lists]

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

Re: Filtering files in dired while invoking

From: suvayu ali
Subject: Re: Filtering files in dired while invoking
Date: Mon, 30 Aug 2010 16:40:45 -0700

Hi Drew,

> > I was trying to filter the files listed in a dired
> > buffer. Filtering with one shell glob works fine, but how do I
> > pass multiple shell globs to dired?  What I 'm looking for is to
> > list files as they would be listed by, $ ls -l *.C *.h *.cxx
> `C-x d *.[Chc]*' gets you part-way there.

Thank you, don't know why this didn't strike me as a solution. :)

> > I couldn't find any reference to this in the info manual. But the
> > docstring for dired says this,
> >
> >       (dired DIRNAME &optional SWITCHES)
> >
> >       .....
> >       If DIRNAME is a cons, its first element is
> >       taken as the directory name and the rest as an explicit list of
> >       files to make directory entries for.
> >       .....
> >
> > How can I achieve that? Thanks for any suggestions.
> The command `dired' does not let you do that.  Its `interactive' spec
> just reads a file (directory) name, possibly with wildcards.
> But function `dired' does let you do that if you call it from Lisp -
> you just need to pass it an explicit list of file names in place of
> the directory name.
> So you could write your own command to do what you want.  The
> `interactive' spec would, e.g., read file names (possibly with
> wildcards) until you enter an empty name ("") - it would return a list
> of the names entered.  The body of the function would just call
> `dired', passing the list (with a (pseudo-)directory name prepended to
> the file names).

I had a hunch that would be the case. I think I'll try my hand at
writing a function like that. Thank you for outlining the basic
idea. :) Maybe I can defadvice `dired' to run my function when ever
there is a space separated argument, and call regular dired

> However, you can often do what you want to do using marking or
> omitting instead.  See `dired-omit-mode' in dired-x.el, for example.
> If you use Dired+, then you can combine marking and omitting - omit
> all of the marked or unmarked files, for instance.
> Marking files is the single most useful thing you can do in Dired.
> You can mark files that match a regexp (`%m'), and so on.  And you
> can of course mark some files matching one pattern and then mark
> some more by matching another pattern.

I was actually doing something similar for now, I was marking the
files, toggling the marks and then killing the lines with `k'.

> With one or more 3rd-party features you can also bookmark or save a
> Dired listing persistently, so you don't have to remark files from
> scratch each time.
> These links might help:

These sound very neat. I had actually tried out icicles at some point,
but I was a too much of a beginner back then and was rather
overwhelmed. :-p I will give those another shot.

Thanks for the wonderful suggestions. :)

PS: I have noticed this before, for some reason most of your replies
don't arrive in my mailbox and I end up reading them from the archive!
And since the "reply-to" button in the archive is broken, I have to copy paste
your response inside my response. My reply will probably show up in
the wrong place of the thread. Probably some problem at my end, Oh
well :-/


Open source is the future. It sets us free.

reply via email to

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